【问题标题】:Extracting phrase n-grams from a sentence corresponding to the main verb从对应于主要动词的句子中提取短语 n-gram
【发布时间】:2016-06-14 11:02:04
【问题描述】:

我正在做一个需要我提取句子之间相似性的项目。因此,给定一个句子,我需要该句子的短语 n-gram,即“主要动词和动词左右的名词短语的组合”。知道如何提取这个吗?我得到了句子的依赖和选区分析树。我正在使用 Python。

Sample Sentence: My dog also likes eating sausage.
Constituency Parse Tree:
ROOT
(S
    (NP (PRP$ My) (NN dog))
    (ADVP (RB also))
    (VP (VBZ likes)
      (S
        (VP (VBG eating)
          (NP (NN sausage)))))
    (. .)))

Dependency Graph:
nmod:poss(dog-2, My-1)
nsubj(likes-4, dog-2)
advmod(likes-4, also-3)
root(ROOT-0, likes-4)
xcomp(likes-4, eating-5)
dobj(eating-5, sausage-6)

主要动词:喜欢

左名词短语(NP):我的狗

正确的名词短语:香肠。

【问题讨论】:

    标签: python graph nlp stanford-nlp


    【解决方案1】:

    你试过Stanford OpenIE吗?或者,就此而言,任何 OpenIE 系统(Ollie / ReVerb / 等)。

    最少使用(通过Simple CoreNLP):

    new Sentence("My dog also likes eating sausage.").openieTriples();

    管道/服务器使用情况:

    创建一个 CoreNLP 管道,并将注释器设置为 tokenize,ssplit,pos,lemma,depparse,natlog,openie。然后,Open IE 三元组应该在句子的RelationTripleAnnotation.class 键上键入。

    corenlp.run尝试一下

    【讨论】:

    • 感谢您的回答!
    猜你喜欢
    • 1970-01-01
    • 2012-09-12
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多