简体   繁体   English

在Eclipse上使用UIMA Framework创建注释器

[英]Create an annotator with UIMA Framework on Eclipse

i'm trying to use the UIMA framework with Eclipse, and fail to do one of the first tutorial on my own... 我正在尝试将UIMA框架与Eclipse结合使用,却无法自己完成第一个教程之一。

(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 RoomNumber.java和RoomNumber_Type.java是通过typeSystemDescriptor.xml自动生成的/使用以下方法打开/组件描述符编辑器=> JCasGen

I think that I have exactly what needed inside them for both RoomNumberAnnotator.xml & typeSystemDescriptor.xml (see below) 我认为我对RoomNumberAnnotator.xml和typeSystemDescriptor.xml都拥有确切的需求(请参见下文)

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 ) RoomNumerAnnotator.java是该教程之一的复制粘贴( 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. 我认为我已经设置了正确的环境变量UIMA_HOME。

I use the examples directory project with the included DocumentAnalyzer that is available there to check my own RoomNumerAnnotator 我将示例目录项目与随附的DocumentAnalyzer一起使用,在那里可以检查我自己的RoomNumerAnnotator

and I always end up with a : 我总是以:

* org.apache.uima.resource.ResourceInitializationException: Annotator class "RoomNumberAnnotator" was not found. * org.apache.uima.resource.ResourceInitializationException:找不到注释器类“ RoomNumberAnnotator”。 (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) [...]* (描述符:文件:/ D:/eclipseWorkspace/uima0/descriptors/RoomNumberAnnotator.xml)位于org.apache.uima.analysis_engine.impl.PrimitiveAnalysisEngine_impl.initializeAnalysisComponent(PrimitiveAnalysisEngine_impl.java:207)位于org.apache.uima.analysis_engine .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) (看起来它可能会丢失我的RoomNumberAnnotator.java和uimaj-examples提供的内置DocumentAnalyzer之间的某些链接?顺便说一句,我不知道如何用Eclipse和UIMA配置文件说/改正它)

---8<--- RoomNumberAnnotator.xml: --- 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 --- 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: 在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) 在Java应用程序下,您将找到Java CAS Visual Debugger(这是假定您已阅读了整个教程,并已在Eclipse中导入了uimaj-examples项目)
  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 运行Java CAS Visual Debugger,选择运行->加载AE,在硬盘上找到描述符文件并加载
  5. Input your text in the text field and run annotation on your input text using Run -> Run AE 在文本字段中输入文本,然后使用运行->运行AE在输入文本上运行注释

I hope that solves your problem! 希望能解决您的问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM