简体   繁体   中英

problems with ambiguity in uima ruta

I have several complex rules that fail when confronted by ambiguous concepts: Here's a simple example:

ANNOTATIONLIST  temp;
DECLARE TestPerson(uima.tcas.Annotation   concept);
DECLARE TestPlace(uima.tcas.Annotation   concept);
DECLARE TestSubject(uima.tcas.Annotation   concept, uima.cas.FSArray  children, String kind);
DECLARE TestModifier(uima.tcas.Annotation   concept);
DECLARE TestBE;
DECLARE TestAdj;
"bank"  ->  TestPerson;
"bank"  -> TestPlace;
"nice"   -> TestAdj;
"was" -> TestBE;
p:TestPlace{-> CREATE(TestSubject,"concept"=p, "children"=p, "kind"="place")};
p:TestPerson{-> CREATE(TestSubject,"concept"=p, "children"=p, "kind"="person")};
a:TestAdj{-> CREATE(TestModifier,"concept"=a)};

DECLARE TestRelation (uima.tcas.Annotation arg1 ,uima.tcas.Annotation arg2,String kind);

(p:TestSubject TestBE? m:TestModifier)
{ ->
            child:CREATE(TestRelation, "kind"="BE", "arg1"=p.concept, "arg2"=m.concept),
                LOG("child1:" + m.ct),
                LOG("parent1:" + p.ct),
                ASSIGN(temp, p.children),  // what we're stuck with
                ADD(temp, child),
                FILL(TestSubject, "children"=temp)
};

For the input sentence "The bank was nice". only ONE of the bank meanings gets 2 children:

<RutaMain:TestPerson xmi:id="2555" sofa="37" begin="4" end="8"/>
  <RutaMain:TestPlace xmi:id="2560" sofa="37" begin="4" end="8"/>
  <RutaMain:TestAdj xmi:id="2565" sofa="37" begin="13" end="17"/>
  <RutaMain:TestBE xmi:id="2569" sofa="37" begin="9" end="12"/>
  <RutaMain:TestSubject xmi:id="2577" sofa="37" begin="4" end="8" concept="2560" children="2555 2657" kind="place"/>
  <RutaMain:TestSubject xmi:id="2591" sofa="37" begin="4" end="8" concept="2555" children="2555" kind="person"/>
  <RutaMain:TestModifier xmi:id="2605" sofa="37" begin="13" end="17" concept="2565"/>
  <RutaMain:TestRelation xmi:id="2622" sofa="37" begin="4" end="17" arg1="2560" arg2="2565" kind="BE"/>
  <RutaMain:TestRelation xmi:id="2657" sofa="37" begin="4" end="17" arg1="2555" arg2="2565" kind="BE"/>

I am using Ruta 2.7.0 but the problems with ambiguity are worse with 2.8.1 (in other cases)

I strongly recommend upgrading to Ruta 3.2.0

(p:TestSubject TestBE? m:TestModifier)
{ -> child:CREATE(TestRelation, "kind"="BE", "arg1"=p.concept, "arg2"=m.concept),
                ASSIGN(temp, p.children), 
                ADD(temp, child),
                p.children=temp
};

结果注释

In your rule, FILL(TestSubject, "children"=temp) matches on the first TestSubject at this position in the index, but not that one matched by the rule element before.

(I tested the rule with the current Ruta version)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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