且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JAPE规则句子包含多个案例

更新时间:2022-11-11 13:31:32

一种解决方法是将其还原.专注于您需要的顺序,然后获得涵盖句:

One way to handle this is to revert it. Focus on the sequence you need and then get the covering Sentence:

(
  {Token@string == "new"}
  {Lookup.majorType = "jobtitle"}
):newJT

当新"之后的句子开始时,您应该检查此边缘,例如:

You should check this edge when the Sentence starts after "new", like this:

new

CEO

您可以使用以下内容:

{Token ... }
{!Sentence, Lookup.majorType ...}

然后在Java RHS中获取句子(如果确实需要):

And then get the sentence (if you really need it) in the java RHS:

long end = newJTAnnots.lastNode().getOffset();
long start = newJTAnnots.firstNode().getOffset();
AnnotationSet sentences = inputAS.get("Sentence", start, end);