我可以使用 Ruta 脚本访问定义为原始类型的功能。例如,postTag 是 TokenAnnotation 的字符串特征。以下脚本有效。
字符串str1,str2;TokenAnnotation{->GETFEATURE("posTag", str1), LOG("posTag=" + str1)};
但是,我无法读取定义为另一种注释类型的功能。
TokenAnnotation 继承了一个叫做 lemma 的特性,它是 Lemma 类型。引理有它自己的特点。“钥匙”就是其中之一。
如何通过 Ruta 脚本中的给定 TokenAnnotation 访问引理的“关键”特征值?
我试过类型变量。但是,我不知道在将引理特征分配给类型变量后我能用它做什么。如果有人可以向我展示一些类型变量用法的示例,那就太好了。
以下是我的类型描述,和 cas. 提前致谢。
<typeDescription>
<name>uima.tt.TokenLikeAnnotation</name>
<description>Base type for token annotation types</description>
<supertypeName>uima.tt.LexicalAnnotation</supertypeName>
<features>
<featureDescription>
<name>lemma</name>
<description>The best probable entry containing all morphological information for the token</description>
<rangeTypeName>uima.tt.Lemma</rangeTypeName>
</featureDescription>
<featureDescription>
<name>lemmaEntries</name>
<description>List of lemma entries containing all morphological information for the token</description>
<rangeTypeName>uima.cas.FSArray</rangeTypeName>
</featureDescription>
<featureDescription>
<name>dictionaryMatch</name>
<description>A flag indicating whether or not the token matches a dictionary entry</description>
<rangeTypeName>uima.cas.Boolean</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
<typeDescription>
<name>uima.tt.TokenAnnotation</name>
<description>General token annotation type. It is also the base type for the special token types</description>
<supertypeName>uima.tt.TokenLikeAnnotation</supertypeName>
<features>
<featureDescription>
<name>posTag</name>
<description>Part-of-Speech tag</description>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
<typeDescription>
<name>uima.tt.KeyStringEntry</name>
<description>Base type for types defining key/value feature (e.g. uima.tt.Lemma type)</description>
<supertypeName>uima.cas.TOP</supertypeName>
<features>
<featureDescription>
<name>key</name>
<description>A key/value feature (e.g. lemma string in uima.tt.Lemma type)</description>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
<typeDescription>
<name>uima.tt.Lemma</name>
<description>Morphological information retrieved from a lexical dictionary entry</description>
<supertypeName>uima.tt.KeyStringEntry</supertypeName>
<features>
<featureDescription>
<name>partOfSpeech</name>
<description>An integral encoding representing the part-of-speech for the lemma</description>
<rangeTypeName>uima.cas.Integer</rangeTypeName>
</featureDescription>
<featureDescription>
<name>frost_ExtendedPOS</name>
<description>An integer representing additional information related to the part-of-speech</description>
<rangeTypeName>uima.cas.Integer</rangeTypeName>
</featureDescription>
<featureDescription>
<name>isStopword</name>
<description/>
<rangeTypeName>uima.cas.Boolean</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
<cas:NULL xmi:id="0"/>
<tcas:DocumentAnnotation xmi:id="8" sofa="1" begin="0" end="70" language="en"/>
<tcas:DocumentAnnotation xmi:id="21" sofa="14" begin="0" end="22" language="en"/>
<ontology:Column xmi:id="27" sofa="14" begin="0" end="11"/>
<ontology:Column xmi:id="31" sofa="14" begin="12" end="22"/>
<ontology:Table xmi:id="35" sofa="14" begin="0" end="22"/>
<uimatypes:TitlecaseAlphabetic xmi:id="42" sofa="14" begin="0" end="8" lemma="74" lemmaEntries="74" dictionaryMatch="true" posTag="NN"/>
<uimatypes:TitlecaseAlphabetic xmi:id="58" sofa="14" begin="12" end="17" lemma="90" lemmaEntries="90" dictionaryMatch="true" posTag="NN"/>
<uimatypes:TitlecaseAlphabetic xmi:id="66" sofa="14" begin="18" end="22" lemma="98" lemmaEntries="98" dictionaryMatch="true" posTag="NN"/>
<uimatypes:UppercaseAlphabetic xmi:id="50" sofa="14" begin="9" end="11" lemma="82" lemmaEntries="82" dictionaryMatch="true" posTag="NN"/>
<tt:SentenceAnnotation xmi:id="106" sofa="14" begin="0" end="22" sentenceNumber="1"/>
<tt:ParagraphAnnotation xmi:id="111" sofa="14" begin="0" end="22" paragraphNumber="1"/>
<type:CW xmi:id="116" sofa="14" begin="0" end="8"/>
<type:CW xmi:id="132" sofa="14" begin="12" end="17"/>
<type:CW xmi:id="140" sofa="14" begin="18" end="22"/>
<type:SPACE xmi:id="120" sofa="14" begin="8" end="9"/>
<type:SPACE xmi:id="128" sofa="14" begin="11" end="12"/>
<type:SPACE xmi:id="136" sofa="14" begin="17" end="18"/>
<type:CAP xmi:id="124" sofa="14" begin="9" end="11"/>
<type:RutaBasic xmi:id="144" sofa="14" begin="0" end="8"/>
<type:RutaBasic xmi:id="149" sofa="14" begin="8" end="9"/>
<type:RutaBasic xmi:id="154" sofa="14" begin="9" end="11"/>
<type:RutaBasic xmi:id="159" sofa="14" begin="11" end="12"/>
<type:RutaBasic xmi:id="164" sofa="14" begin="12" end="17"/>
<type:RutaBasic xmi:id="169" sofa="14" begin="17" end="18"/>
<type:RutaBasic xmi:id="174" sofa="14" begin="18" end="22"/>
<demo:Identifier xmi:id="187" sofa="14" begin="0" end="11"/>
<cas:Sofa xmi:id="1" sofaNum="2" sofaID="global1" mimeType="text" sofaString="<Table><Column>Employee ID</Column><Column>Birth Date</Column></Table>"/>
<cas:Sofa xmi:id="14" sofaNum="3" sofaID="global2" mimeType="text" sofaString="Employee ID Birth Date"/>
<tt:Lemma xmi:id="74" key="employee" partOfSpeech="3" frost_ExtendedPOS="0" isStopword="false"/>
<tt:Lemma xmi:id="90" key="birth" partOfSpeech="3" frost_ExtendedPOS="0" isStopword="false"/>
<tt:Lemma xmi:id="98" key="date" partOfSpeech="3" frost_ExtendedPOS="0" isStopword="false"/>
<tt:Lemma xmi:id="82" key="id" partOfSpeech="3" frost_ExtendedPOS="0" isStopword="false"/>
<cas:View sofa="1" members="8"/>
<cas:View sofa="14" members="21 27 31 35 42 58 66 50 106 111 116 132 140 120 128 136 124 144 149 154 159 164 169 174 187"/>