ctakes-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour Al Akeel <mansour.alak...@gmail.com>
Subject Re: Initializing and using clinical pipleline from java
Date Fri, 28 Nov 2014 17:12:03 GMT
James,
Thank you for your time. I tried to instantiate the descriptor using:

    AnalysisEngineDescription ced =
ClinicalPipelineFactory.getDefaultPipeline();


but getting an exception:


java.lang.IllegalArgumentException: URI is not hierarchical
    at java.io.File.<init>(File.java:392)
    at org.apache.ctakes.lvg.ae.LvgAnnotator.createAnnotatorDescription(LvgAnnotator.java:565)
    at org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.getTokenProcessingPipeline(ClinicalPipelineFactory.java:78)
    at org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.getDefaultPipeline(ClinicalPipelineFactory.java:58)
    .....



The exact location for this is in the LvgAnnotator class:

    public static AnalysisEngineDescription
createAnnotatorDescription() throws ResourceInitializationException {
      try {
      return AnalysisEngineFactory.createPrimitiveDescription(LvgAnnotator.class,
          LvgAnnotator.PARAM_USE_CMD_CACHE,
          false,
          LvgAnnotator.PARAM_USE_LEMMA_CACHE,
          false,
          LvgAnnotator.PARAM_USE_SEGMENTS,
          false,
          LvgAnnotator.PARAM_LEMMA_CACHE_FREQUENCY_CUTOFF,
          20,
          LvgAnnotator.PARAM_LEMMA_FREQ_CUTOFF,
          20,
          LvgAnnotator.PARAM_POST_LEMMAS,
          false,
          LvgAnnotator.PARAM_LVGCMDAPI_RESRC_KEY,
          ExternalResourceFactory.createExternalResourceDescription(
              LvgCmdApiResourceImpl.class,
              new File(LvgCmdApiResourceImpl.class.getResource(
                  "/org/apache/ctakes/lvg/data/config/lvg.properties").toURI()))
          );
    } catch (URISyntaxException e) {
      throw new ResourceInitializationException(e);
    }
    }


>From the javadoc for java.io.File:
==========================================
public boolean isOpaque()

Tells whether or not this URI is opaque.

A URI is opaque if, and only if, it is absolute and its
scheme-specific part does not begin with a slash character ('/'). An
opaque URI has a scheme, a scheme-specific part, and possibly a
fragment; all other components are undefined.

Returns:true if, and only if, this URI is opaque
========================================

I am somewhat lost because  in the LvgAnnotator we are passing
"/org/apache/ctakes/lvg/data/config/lvg.properties", and it is suppose
to work fine.
However from JUnit it's throwing the above exception because the path
starts with slash.


any idea ??


On Fri, Nov 28, 2014 at 10:56 AM, Masanz, James J.
<Masanz.James@mayo.edu> wrote:
>
> The dictionary lookup annotator requires other annotators be run first.
>
> see
> https://svn.apache.org/repos/asf/ctakes/trunk/ctakes-clinical-pipeline/src/main/java/org/apache/ctakes/clinicalpipeline/ClinicalPipelineFactory.java
>
> -- James Masanz
>
> ________________________________________
> From: Mansour Al Akeel [mansour.alakeel@gmail.com]
> Sent: Friday, November 28, 2014 8:45 AM
> To: user
> Subject: Initializing and using clinical pipleline from java
>
> I am using the following code to test initialization for the clinical
> annotator from a junit test case:
>
>
>     AnalysisEngineDescription description =
> UmlsDictionaryLookupAnnotator.createAnnotatorDescription();
>
>     AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(description);
>
>     URL testFile = this.getClass().getResource("/clinical-text-1.txt");
>
>     byte[] encoded = Files.readAllBytes(Paths.get(testFile.toURI()));
>
>     String encoding = "UTF-8";
>
>     String textContent = new String(encoded, encoding);
>
>     JCas jcas = ae.newJCas();
>
>     jcas.setDocumentText(textContent);
>
>     long start = System.currentTimeMillis();
>     ae.process(jcas);
>     long end = System.currentTimeMillis();
>
>     System.out.println("processing done in : " + ((end - start) / 1000.0));
>
>     XmlCasSerializer.serialize(jcas.getCas(), System.out);
>
>     jcas.reset();
>
>
> The output is produced, however, there's no annotations added, and no
> error or exception is thrown.
>
> Am I missing something here??
>
> Thank you.

Mime
View raw message