2

Ruta スクリプトを使用して、プリミティブ型として定義された機能にアクセスできます。たとえば、posTag は TokenAnnotation の文字列機能です。次のスクリプトが機能します。

STRING str1、str2; TokenAnnotation{->GETFEATURE("posTag", str1), LOG("posTag=" + str1)};

しかし、別の Annotation タイプとして定義されているフィーチャーを読み取ることができません。

TokenAnnotation は、Lemma 型である lemma と呼ばれる機能を継承します。Lemma には独自の機能があります。「鍵」もその一つです。

Rutaスクリプトで指定されたTokenAnnotationを介してLemmaの「キー」機能値にアクセスするにはどうすればよいですか?

Type変数を試してみました。しかし、レンマ機能を型変数に割り当てた後、何ができるかわかりません。誰かが Type 変数の使用例をいくつか示してくれれば素晴らしいことです。

以下は、私のタイプの説明と 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="&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"/>

4

1 に答える 1

0

はい、できますが、UIMA Ruta 2.4.0 (現在のリリース) では TOP 機能構造のサポートが制限されています。注釈タイプのみがサポートされています。

これは、UIMA Ruta の特徴表現で最もうまく機能します。単純にドットを使用して、一致した注釈の機能を参照できます (積み重ねることができます)。

あなたの例では、これは次のようになります。

TokenAnnotation.lemma.key=="birth"{-> T1};
TokenAnnotation{TokenAnnotation.posTag=="NN" -> T1};

...しかし、おそらく型システムuima.cas.TOPで withを置き換える必要があります。uima.tcas.Annotation

型検証はこれを解決するのに役立ちませんが、新しい注釈変数はここで役立つ可能性がありますが、実際には必要ありません。

免責事項: 私は UIMA Ruta の開発者です

于 2016-03-21T12:50:20.190 に答える