首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Ruta脚本中访问非原始类型的特征值?

如何在Ruta脚本中访问非原始类型的特征值?
EN

Stack Overflow用户
提问于 2016-03-16 02:08:03
回答 1查看 594关注 0票数 2

我可以使用Ruta脚本访问定义为原语类型的特性。例如,posTag是TokenAnnotation的字符串功能。下面的脚本可以工作。

STRING日志,日志;TokenAnnotation{->GETFEATURE("posTag",str1),str1 (“posTag=”+ str1)};

但是,我无法读取被定义为另一个Annotation类型的特征。

TokenAnnotation继承了一个名为引理的特性,它的类型是引理。引理有它自己的特点。"key“就是其中之一。

如何在Ruta脚本中通过给定的TokenAnnotation访问引理的“键”特征值?

我尝试了类型变量。但是,在将引理功能分配给类型变量之后,我不知道我能用它做什么。如果有人能给我展示一些Type变量用法的例子,那就太好了。

下面是我的类型描述和cas。提前谢谢。

代码语言:javascript
运行
复制
            <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="&lt;Table&gt;&lt;Column&gt;Employee ID&lt;/Column&gt;&lt;Column&gt;Birth Date&lt;/Column&gt;&lt;/Table&gt;"/>
<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"/>

EN

回答 1

Stack Overflow用户

发布于 2016-03-21 20:50:20

是的,你可以这样做,但在UIMA Ruta 2.4.0 (当前版本)中,对TOP功能结构的支持是有限的。仅支持注释类型。

这与UIMA Ruta中的feature expressions配合使用效果最好。您可以简单地使用一个点来引用匹配注释的一个特征(可以堆叠)。

在您的示例中,可能如下所示:

代码语言:javascript
运行
复制
TokenAnnotation.lemma.key=="birth"{-> T1};
TokenAnnotation{TokenAnnotation.posTag=="NN" -> T1};

..。但是在您的类型系统中,您可能需要用uima.tcas.Annotation替换uima.cas.TOP

类型veriable不会帮助解决这个问题,但新的注释变量在这里可能会有所帮助,但实际上并不是必需的。

免责声明:我是UIMA Ruta的开发者

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36018880

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档