如何在RelationExtractor的RelationMention中将NamedEntityTag用作EntityMention?

时间:2015-06-07 15:35:24

标签: nlp stanford-nlp

我正在尝试训练自己的NamedEntityRecognizerRelationExtractor。我管理了NER模型,但与RelationExtractor的集成有点棘手。我得到了正确的NamedEntityTag s,但是RelationMention找到的NamedEntity只有一个版本,没有额外的[Text=President CharacterOffsetBegin=10 CharacterOffsetEnd=19 PartOfSpeech=NNP Lemma=President NamedEntityTag=PRESIDENT] [Text=Nixon CharacterOffsetBegin=20 CharacterOffsetEnd=25 PartOfSpeech=NNP Lemma=Nixon NamedEntityTag=PRESIDENT] Extracted the following MachineReading relation mentions: RelationMention [type=Live_In, start=0, end=4, {Live_In, 0.3719730539322602; OrgBased_In, 0.22490833335685645; _NR, 0.17474696244295865; Work_For, 0.11754788838692569; Located_In, 0.11082376188099895} EntityMention [type=O, objectId=EntityMention-2, hstart=3, hend=4, estart=2, eend=4, headPosition=3, value="Nixon", corefID=-1] EntityMention [type=LOCATION, objectId=EntityMention-1, hstart=0, hend=1, estart=0, eend=1, headPosition=0, value="America", corefID=-1] ] 而不是默认版本。我收到了输入文字:

  美国总统尼克松通过了一项新法律。

我得到了以下输出:

Task run = new Task(JSON.parse(message));    
service.execute(new TestWrapperThread(getChannel(),run,envelope.getDeliveryTag()));

1 个答案:

答案 0 :(得分:0)

您可以将EntityMention中的文本与NamedEntityTag中的NamedEntityText值进行匹配。