UIMA Ruta 错误锦集(一):MATCHEDTEXT用法
作者:互联网
MATCHEDTEXT用来提取一个variable里的text。
如:提取一个句子后,在selection view里查看句子中各个成分的content时,我们会看到:
patternValue1是对这部分内容的描述,而非text本身。而patternValue2-4是text本身。
造成此情况的原因是,在create时,patternValue1后面是variable,而余下三个则被赋值为对应variable包含的text。
代码如下:
DECLARE PredicateRef;
STRING test1,test2,test3, test4;
STRING M1,M2,M3,M4;
STRING Geo1,Geo2,Geo3,Geo4;
p1:Predicate{AND(OR(p1.prSemantics=="desc_obj_state",p1.prSemantics=="desc_obj_augmentation", p1.prSemantics=="desc_obj_reduction"), OR(p1.prStructure=="[epiv ipv]", p1.prStructure=="ipv"))} Lemma.value=="by"?{->MARK(PredicateRef, 1, 2)};
Sentence {->MATCHEDTEXT(ExtractText)}->{
//Comparing a to b, indicator1 predicates v1 in Geo1(la position may change), predicates2 v2 in Geo2, predicate3 v3 in Geo3 and predicate4 v4 in Geo4”
CompareTo
i1:Indicator Where?{->MATCHEDTEXT(Geo1)} PredicateRef{->MATCHEDTEXT(test1)} v1:Measure{->MATCHEDTEXT(M1)} Where?{->MATCHEDTEXT(Geo1)}
//ANY+? in case we have () in between
ANY*? Connectors
Where?{->MATCHEDTEXT(Geo2)} PredicateRef?{->MATCHEDTEXT(test2)} VariAdv?{->MATCHEDTEXT(test2)} v2:Measure{->MATCHEDTEXT(M2)} Where?{->MATCHEDTEXT(Geo2)}
//3
ANY*? Connectors
Where?{->MATCHEDTEXT(Geo3)} PredicateRef?{->MATCHEDTEXT(test3)} VariAdv?{->MATCHEDTEXT(test3)} v3:Measure{->MATCHEDTEXT(M3)} Where?{->MATCHEDTEXT(Geo3)}
//4
ANY*? Connectors
Where?{->MATCHEDTEXT(Geo4)} PredicateRef?{->MATCHEDTEXT(test4)} VariAdv?{->MATCHEDTEXT(test4)} v4:Measure{->MATCHEDTEXT(M4)} Where?{->MATCHEDTEXT(Geo4)}
ANY*? Connectors
{->CREATE(MergeCompareValueWithReference, 1, 50, "patternIndicator1"=i1.kpiToken, "patternPredicate1"=test1, "patternValue1"=v1, "entityGeo1"=Geo1, "patternPredicate2"=test2, "patternValue2"=M2, "entityGeo2"=Geo2, "patternPredicate3"=test3, "patternValue3"=M3, "entityGeo3"=Geo3, "patternPredicate4"=test4, "patternValue4"=M4, "entityGeo4"=Geo4, "match"=ExtractText)};
//"patternIndicator2"=i2.kpiToken, "patternPredicate2"=PredicateRef.prToken, "patternPredicate2"=VariAdv.prToken, "patternValue2"=v2, "match"=ExtractText)};
};
最开始定义M1,M2,M3,M4用来储存text。
在代码中用v1:Measure{->MATCHEDTEXT(M1)}
提取变量v1的text。在最后create时候,若"patternValue1"=v1,
则selection view中出现描述。若"patternValue1"=M1,
则selction view中展现句子中v1代表的具体text。
标签:p1,UIMA,text,v1,Ruta,PredicateRef,锦集,Where,MATCHEDTEXT 来源: https://blog.csdn.net/NPLbald/article/details/113817993