【发布时间】:2022-04-18 03:35:40
【问题描述】:
我已经用尽了所有我知道的配置选项:
from openie import StanfordOpenIE
# https://stanfordnlp.github.io/CoreNLP/openie.html#api
# Default value of openie.affinity_probability_cap was 1/3.
properties = {
"annotators":"tokenize,ssplit,pos,depparse,natlog,openie",
'openie.affinity_probability_cap': 2 / 3,
"openie.triple.strict":"true",
'openie.max_entailments_per_clause': 1,
'splitter.disable': True
}
with StanfordOpenIE(properties=properties) as client:
text = 'Barack Obama was born in Hawaii. Richard Manning wrote this sentence.'
print('Text: %s.' % text)
for triple in client.annotate(text): #, max_entailments_per_clause=True):
print('|-', triple)
但结果仍然包含未合并的重复变体:
|- {'subject': 'Barack Obama', 'relation': 'was', 'object': 'born'}
|- {'subject': 'Barack Obama', 'relation': 'was born in', 'object': 'Hawaii'}
而我只是在寻找最大的子句提取结果:
|- {'subject': 'Barack Obama', 'relation': 'was born in', 'object': 'Hawaii'}
有人可以帮我解决这个问题吗?
【问题讨论】:
标签: python stanford-nlp information-extraction