You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by "Chen, Pei" <Pe...@childrens.harvard.edu> on 2013/04/21 22:05:27 UTC

Re: Feature not defined for type exception - need some help

Hi,
Could you also attach the desc xml file described below?
The error seems to suggest that the Type System is not being loaded/used correctly. Also, could you also elaborate how the cTAKES jar/lib/classes are loaded into your project?
In particular
org.apache.ctakes.typesystem.type.textspan.Segment
Those classes should have a setId() method if I'm not mistaken.


Sent from my iPhone

On Apr 19, 2013, at 10:58 AM, "David Kincaid" <ki...@gmail.com>> wrote:

I'm new to both cTakes and UIMA, so please excuse if this is a simple question. Can someone help me understand why the following code produces the listed exception? The bolded line seems to hold the key, but I don't understand what it's telling me.

public class MedicalNoteProcessor {

    private static final String AE_DESCRIPTOR = "/home/davek/src/medical-notes/AE/SimpleSegmentAnnotator.xml";

    private static final String TEST_TEXT = "Abnormal Remarks: rostral-most right nasal fold and adjacent skin are swollen to about 1.5cm in width, spherical, with ulcerated surface near nostril opening. No draining or appreciable pain associated. Mild mucoid to purulent discharge in the nostril. Left side normalMouth/Teeth/Gum";

    public static void main(String[] args) throws IOException, InvalidXMLException, ResourceInitializationException, AnalysisEngineProcessException {
        XMLInputSource xmlInputSource = new XMLInputSource(AE_DESCRIPTOR);

        ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(xmlInputSource);
        AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);

        JCas jcas = ae.newJCas();

        //analyze a document
        jcas.setDocumentText(TEST_TEXT);
        ae.process(jcas);
        UIMAFramework.getLogger().log(Level.INFO, jcas.toString());

        jcas.reset();

        //done
        ae.destroy();
    }
}

Exception in thread "main" org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator processing failed.
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:391)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:296)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
at org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:280)
at medical_notes.nlp.MedicalNoteProcessor.main(MedicalNoteProcessor.java:42)
Caused by: org.apache.uima.cas.CASRuntimeException: Feature "id" is not defined for type "org.apache.ctakes.typesystem.type.textspan.Segment".
at org.apache.uima.jcas.impl.JCasImpl.throwFeatMissing(JCasImpl.java:1018)
at org.apache.ctakes.typesystem.type.textspan.Segment.setId(Segment.java:80)
at org.apache.ctakes.core.ae.SimpleSegmentAnnotator.process(SimpleSegmentAnnotator.java:63)
at org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:375)

Re: Feature not defined for type exception - need some help

Posted by David Kincaid <ki...@gmail.com>.
Thanks for the reply. The problem was that I wasn't properly including all
of the cTakes libraries. I also discovered UIMAFit which makes things so
much easier. Especially for those of us that despise using XML for
configuration. It's been quite a weekend trying to figure all of this out
(UIMA and cTakes both). Not being an Eclipse user has made things even more
difficult since both projects assume that developers are using Eclipse for
their IDE.

The end result, though, is some pretty decent looking code that runs the
AggregatePlaintextUMLSProcessor with a FilesInDirectoryCollectionReader and
a CasFileWriter (which is CasConsumer turned into an AE since CasConsumer's
seem to be deprecated) in a pipeline.

My next step is to try to figure out the XCAS file format so I can do
something with the results. I'm sure I'll be back on with more questions.

Dave



On Sun, Apr 21, 2013 at 3:05 PM, Chen, Pei
<Pe...@childrens.harvard.edu>wrote:

>  Hi,
> Could you also attach the desc xml file described below?
> The error seems to suggest that the Type System is not being loaded/used
> correctly. Also, could you also elaborate how the cTAKES jar/lib/classes
> are loaded into your project?
> In particular
>
> *org.apache.ctakes.typesystem.type.textspan.Segment*
>
> Those classes should have a setId() method if I'm not mistaken.
>
>
> Sent from my iPhone
>
> On Apr 19, 2013, at 10:58 AM, "David Kincaid" <ki...@gmail.com>
> wrote:
>
>   I'm new to both cTakes and UIMA, so please excuse if this is a simple
> question. Can someone help me understand why the following code produces
> the listed exception? The bolded line seems to hold the key, but I don't
> understand what it's telling me.
>
>  public class MedicalNoteProcessor {
>
>      private static final String AE_DESCRIPTOR =
> "/home/davek/src/medical-notes/AE/SimpleSegmentAnnotator.xml";
>
>      private static final String TEST_TEXT = "Abnormal Remarks:
> rostral-most right nasal fold and adjacent skin are swollen to about 1.5cm
> in width, spherical, with ulcerated surface near nostril opening. No
> draining or appreciable pain associated. Mild mucoid to purulent discharge
> in the nostril. Left side normalMouth/Teeth/Gum";
>
>      public static void main(String[] args) throws IOException,
> InvalidXMLException, ResourceInitializationException,
> AnalysisEngineProcessException {
>         XMLInputSource xmlInputSource = new XMLInputSource(AE_DESCRIPTOR);
>
>          ResourceSpecifier specifier =
> UIMAFramework.getXMLParser().parseResourceSpecifier(xmlInputSource);
>         AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
>
>          JCas jcas = ae.newJCas();
>
>          //analyze a document
>         jcas.setDocumentText(TEST_TEXT);
>         ae.process(jcas);
>         UIMAFramework.getLogger().log(Level.INFO, jcas.toString());
>
>          jcas.reset();
>
>          //done
>         ae.destroy();
>     }
> }
>
>  Exception in thread "main"
> org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
> processing failed.
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:391)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:296)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:280)
> at
> medical_notes.nlp.MedicalNoteProcessor.main(MedicalNoteProcessor.java:42)
> *Caused by: org.apache.uima.cas.CASRuntimeException: Feature "id" is not
> defined for type "org.apache.ctakes.typesystem.type.textspan.Segment".*
> at org.apache.uima.jcas.impl.JCasImpl.throwFeatMissing(JCasImpl.java:1018)
> at
> org.apache.ctakes.typesystem.type.textspan.Segment.setId(Segment.java:80)
> at
> org.apache.ctakes.core.ae.SimpleSegmentAnnotator.process(SimpleSegmentAnnotator.java:63)
> at
> org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:375)
>
>

Re: Feature not defined for type exception - need some help

Posted by David Kincaid <ki...@gmail.com>.
Thanks for the reply. The problem was that I wasn't properly including all
of the cTakes libraries. I also discovered UIMAFit which makes things so
much easier. Especially for those of us that despise using XML for
configuration. It's been quite a weekend trying to figure all of this out
(UIMA and cTakes both). Not being an Eclipse user has made things even more
difficult since both projects assume that developers are using Eclipse for
their IDE.

The end result, though, is some pretty decent looking code that runs the
AggregatePlaintextUMLSProcessor with a FilesInDirectoryCollectionReader and
a CasFileWriter (which is CasConsumer turned into an AE since CasConsumer's
seem to be deprecated) in a pipeline.

My next step is to try to figure out the XCAS file format so I can do
something with the results. I'm sure I'll be back on with more questions.

Dave



On Sun, Apr 21, 2013 at 3:05 PM, Chen, Pei
<Pe...@childrens.harvard.edu>wrote:

>  Hi,
> Could you also attach the desc xml file described below?
> The error seems to suggest that the Type System is not being loaded/used
> correctly. Also, could you also elaborate how the cTAKES jar/lib/classes
> are loaded into your project?
> In particular
>
> *org.apache.ctakes.typesystem.type.textspan.Segment*
>
> Those classes should have a setId() method if I'm not mistaken.
>
>
> Sent from my iPhone
>
> On Apr 19, 2013, at 10:58 AM, "David Kincaid" <ki...@gmail.com>
> wrote:
>
>   I'm new to both cTakes and UIMA, so please excuse if this is a simple
> question. Can someone help me understand why the following code produces
> the listed exception? The bolded line seems to hold the key, but I don't
> understand what it's telling me.
>
>  public class MedicalNoteProcessor {
>
>      private static final String AE_DESCRIPTOR =
> "/home/davek/src/medical-notes/AE/SimpleSegmentAnnotator.xml";
>
>      private static final String TEST_TEXT = "Abnormal Remarks:
> rostral-most right nasal fold and adjacent skin are swollen to about 1.5cm
> in width, spherical, with ulcerated surface near nostril opening. No
> draining or appreciable pain associated. Mild mucoid to purulent discharge
> in the nostril. Left side normalMouth/Teeth/Gum";
>
>      public static void main(String[] args) throws IOException,
> InvalidXMLException, ResourceInitializationException,
> AnalysisEngineProcessException {
>         XMLInputSource xmlInputSource = new XMLInputSource(AE_DESCRIPTOR);
>
>          ResourceSpecifier specifier =
> UIMAFramework.getXMLParser().parseResourceSpecifier(xmlInputSource);
>         AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
>
>          JCas jcas = ae.newJCas();
>
>          //analyze a document
>         jcas.setDocumentText(TEST_TEXT);
>         ae.process(jcas);
>         UIMAFramework.getLogger().log(Level.INFO, jcas.toString());
>
>          jcas.reset();
>
>          //done
>         ae.destroy();
>     }
> }
>
>  Exception in thread "main"
> org.apache.uima.analysis_engine.AnalysisEngineProcessException: Annotator
> processing failed.
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:391)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.processAndOutputNewCASes(PrimitiveAnalysisEngine_impl.java:296)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:267)
> at
> org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase.process(AnalysisEngineImplBase.java:280)
> at
> medical_notes.nlp.MedicalNoteProcessor.main(MedicalNoteProcessor.java:42)
> *Caused by: org.apache.uima.cas.CASRuntimeException: Feature "id" is not
> defined for type "org.apache.ctakes.typesystem.type.textspan.Segment".*
> at org.apache.uima.jcas.impl.JCasImpl.throwFeatMissing(JCasImpl.java:1018)
> at
> org.apache.ctakes.typesystem.type.textspan.Segment.setId(Segment.java:80)
> at
> org.apache.ctakes.core.ae.SimpleSegmentAnnotator.process(SimpleSegmentAnnotator.java:63)
> at
> org.apache.uima.analysis_component.JCasAnnotator_ImplBase.process(JCasAnnotator_ImplBase.java:48)
> at
> org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.callAnalysisComponentProcess(PrimitiveAnalysisEngine_impl.java:375)
>
>