How to access a child tag of a string array in UIMA-RUTA?

We are having trouble getting data from an XMI file. The following excerpt illustrates an example of what we are trying to do:

<uima:Token xmi:id="28" sofa="1" begin="3" end="6" pos="v-fin" features="PR=1S=IND" lexeme="sou">
    <lemma>ser</lemma>
</uima:Token>

We know how to get the information contained in the first line, such as identifier, start, sofa, etc. (these are attributes), which can be obtained using the following code:

IMPORT opennlp.uima.Token FROM TypeSystem AS cgToken;
// ...
cgToken{REGEXP(cgToken.lexeme, "sou", true) -> DO_SOME_ACTION};
// do some action if the lexeme is "sou"

However, as we have already said, we want to know how to get the lemma (string "ser") in the previous example, which is in the child tag.

Obviously, we tried cgToken{REGEXP(cgToken.lemma, "ser", true) -> DO_SOME_ACTION};that does not work, because the lemma is not an attribute of cgToken. In addition, there can be more than one lemma within one cgToken.

TypeSystem defines this function as follows:

<featureDescription>
    <name>lemma</name>
    <description>lemma</description>
    <rangeTypeName>uima.cas.StringArray</rangeTypeName>
</featureDescription>

However, the Ruta Documentation does not explain how to access an array field.

+4
source share

All Articles