ctakes-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siamak Barzegar <barzegar.sia...@gmail.com>
Subject Re: Accessing the External Resource from the UimaContext without Using XML descriptor [EXTERNAL]
Date Tue, 25 Jun 2019 15:46:36 GMT
Thank Sean,

But it seems it is just fine for getting parameters, not external resources,
please see this file:
https://github.com/apache/ctakes/blob/ctakes-4.0.0/ctakes-dictionary-lookup/desc/analysis_engine/DictionaryLookupAnnotatorCSV.xml

It has several externalResourceDependency that need to be run on
externalResource. How can I do it on the pipelinebiler? Do you any
suggestions?

>From Tutorial.ex6 from example UIMA:

"When the Analysis Engine is initialized, it creates a single instance of
StringMapResource_impl and loads it with the contents of the data file.
This means that the framework calls the instance's load method, passing it
an instance of DataResource, from which you can obtain a stream or URI/URL
of the external resource that was declared in the external resource..."

How can do the same for Resource Dependencies in
DictionalyLookuoAnnotatorCSV.xml?

With Best Wishes,
Siamak


On Tue, 25 Jun 2019 at 16:38, Finan, Sean <Sean.Finan@childrens.harvard.edu>
wrote:

> Hi Siamak,
>
> Good question.  Yet another shortfall in the documentation ...
>
> There are several ways to set parameters in the  PipelineBuilder.
>
> The javadocs for the 4.0.0 release version are here:
> http://ctakes.apache.org/apidocs/4.0.0/
>
> You can use the set(..) method to set "global" values, or place
> component-specific values using the add(..) method.
>
> The PipelineBuilder in trunk has the additional method:
> setIfEmpty(..)        Just like set(..) except any given attributes are
> ignored if they already have values
>
> In addition, the add( component, parameters... ) in trunk has been changed
> to:
> add( component, views, parameters ).
> Views are usually used for training ml models.  To use add(..) like the
> original (without special views) specify add( component,
> Collections.emptyList(), parameters ).   The method usage add( component )
> still exists.  Apparently I was too lazy to properly refactor the method
> with the original signature ...
>
> I hope that helps,
> Sean
>
> ________________________________________
> From: Siamak Barzegar <barzegar.siamak@gmail.com>
> Sent: Tuesday, June 25, 2019 9:23 AM
> To: dev@ctakes.apache.org
> Subject: Accessing the External Resource from the UimaContext without
> Using XML descriptor [EXTERNAL]
>
> I would like to use different cTAKES' components by using PipelineBuilder
> (exactly the same in HelloWorldBuilderRunner.java).
> But the problem is (As I understand it), PipelineBuilder does not read XML
> descriptor of the component. I want to use the Dictionary Lookup component
> (DictionaryLookupannotatorCSV.xml) in the following components:
>
>          PipelineBuilder builder = new PipelineBuilder();
>          builder
>               .add( SimpleSegmentAnnotator.class )
>               .add( SentenceDetector.class )
>               .add( TokenizerAnnotator.class )
>                // Java Class file of DictionaryLookupannotatorCSV.xml is:
>               .add(DictionaryLookupAnnotator.class);
>
> But in the DictionaryLookupannotatorCSV.xml file, there are several
> external resources that DictionaryLookupAnnotator needs to read them:
>
> public void initialize(UimaContext aContext) {
>   iv_context = aContext;
>    ....
>   FileResource fResrc = (FileResource)
> iv_context.getResourceObject("LookupDescriptor");
>     ...
>    iv_lookupSpecSet = LookupParseUtilities.parseDescriptor(descFile,
> iv_context);
> }
>
> So, what is the best way for having access to these
> resources(LookupDescriptorFile, DictionaryFileResource, RxnormIndex and
> OrangeBookIndex) in DictionaryLookupannotatorCSV.xml from the code?
>
> Thanks a lot.
> Siamak
>


-- 
Siamak Barzegar, PhD.
Senior Research Engineer.
Biomedical Text Mining Unit.
Barcelona Supercomputing Centre

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message