I'm trying to train my own NamedEntityRecognizer
and RelationExtractor
. I've managed the NER
model, but the integration with the RelationExtractor
is a bit tricky. I get the right NamedEntityTag
s, but the RelationMention
s found by the are only one-term and with no extra NamedEntity
than the default ones. I got input text:
America's President Nixon has passed a new law.
and I got the following output:
[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]
]
You can match the text from the EntityMention with the NamedEntityText value from the NamedEntityTag.