i'm trying to use the UIMA framework with Eclipse, and fail to do one of the first tutorial on my own...

(I was first trying to do my own annotator, with words and so on, and then get the exact same errors about : Annotator class "*" was not found., so I came back to the tutorial to check what I have missed, but still get this kind of errors :/)

here is my files/directories structure

uima0
--- src
------- (default package)
---------- RoomNumber.java
---------- RoomNumber_Type.java
---------- RoomNumberAnnotator.java
--- JRE system Library [JavaSE-1.7]
--- Referenced Libraries
------ uima-core.jar
--- descriptors
------ RoomNumberAnnotator.xml
------ typeSystemDescriptor.xml
--- lib
------- uima-core.jar

RoomNumber.java & RoomNumber_Type.java are auto generated via typeSystemDescriptor.xml / Open With / Component Descriptor Editor => JCasGen

I think that I have exactly what needed inside them for both RoomNumberAnnotator.xml & typeSystemDescriptor.xml (see below)

RoomNumerAnnotator.java is a copy n' paste of the one of the tutorial (http://uima.apache.org/d/uimaj-2.3.1/tutorials_and_users_guides.html#d4e236)

I think that I have set right environnement variables UIMA_HOME.

I use the examples directory project with the included DocumentAnalyzer that is available there to check my own RoomNumerAnnotator

and I always end up with a :

*org.apache.uima.resource.ResourceInitializationException: Annotator class "RoomNumberAnnotator" was not found. (Descriptor: file:/D:/eclipseWorkspace/uima0/descriptors/RoomNumberAnnotator.xml) at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:207) at org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initialize(PrimitiveAnalysisEngine_impl.java:156) [...]*

what did i forgot or missed ?

(looks like that it may miss some links between the place where is my RoomNumberAnnotator.java and the built in DocumentAnalyzer provided with uimaj-examples ? BTW, I did not know how to say/correct that with Eclipse and or UIMA configuration files)

---8<--- RoomNumberAnnotator.xml:

  <?xml version="1.0" encoding="UTF-8"?>
    <analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
      <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
      <primitive>true</primitive>
      <annotatorImplementationName>RoomNumberAnnotator</annotatorImplementationName>
      <analysisEngineMetaData>
        <name>RoomNumberAnnotator</name>
        <description/>
        <version>1.0</version>
        <vendor/>
        <configurationParameters/>
        <configurationParameterSettings/>
        <typeSystemDescription>
          <imports>
            <import location="typeSystemDescriptor.xml"/> <!-- here putting full path as :  import location="file:/D:/eclipseWorkspace/uima0/descriptors/typeSystemDescriptor.xml" did not help -->
          </imports>
        </typeSystemDescription>
        <typePriorities/>
        <fsIndexCollection/>
        <capabilities>
          <capability>
            <inputs/>
            <outputs>
              <type>RoomNumber</type>
              <feature>RoomNumber:building</feature>
            </outputs>
            <languagesSupported/>
          </capability>
        </capabilities>
        <operationalProperties>
          <modifiesCas>true</modifiesCas>
          <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
          <outputsNewCASes>false</outputsNewCASes>
        </operationalProperties>
      </analysisEngineMetaData>
      <resourceManagerConfiguration/>
    </analysisEngineDescription>

---8<--- typeSystemDescriptor

<?xml version="1.0" encoding="UTF-8"?>
<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
  <name>typeSystemDescriptor</name>
  <description/>
  <version>1.0</version>
  <vendor/>
  <types>
    <typeDescription>
      <name>RoomNumber</name>
      <description/>
      <supertypeName>uima.tcas.Annotation</supertypeName>
      <features>
        <featureDescription>
          <name>building</name>
          <description/>
          <rangeTypeName>uima.cas.String</rangeTypeName>
        </featureDescription>
      </features>
    </typeDescription>
  </types>
</typeSystemDescription>
有帮助吗?

解决方案

I am pretty sure you're missing to include your classes in the classpath. Try the following in Eclipse:

  1. Select Run Configurations
  2. Under Java Application you will find Java CAS Visual Debugger (that is assuming you followed the whole tutorial and have the uimaj-examples project imported in Eclipse)
  3. Go to Classpath -> Add Projects... and add the sample project you created
  4. Run Java CAS Visual Debugger, select Run -> Load AE, locate your descriptor file on your hard disk and load it
  5. Input your text in the text field and run annotation on your input text using Run -> Run AE

I hope that solves your problem!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top