NLP - 识别哪个形容词描述句子中的哪个名词

Ste*_*ito 1 nlp text-mining data-science

我需要一种方法/算法来识别哪个形容词与句子中的哪个名词有关.

样本输入:

"The product itself is good however this company has a terrible service"
Run Code Online (Sandbox Code Playgroud)

作为输出,我想得到类似的东西:

[product, good]
[service, terrible]
Run Code Online (Sandbox Code Playgroud)

你能指点一些有助于完成这项任务的算法/库吗?

Was*_*mad 5

您可以使用Stanford依赖解析器,也可以使用此相关论文.您也可以查看他们的在线工具.例如,对于您的句子,您可以从斯坦福解析器中获取以下内容.

您的查询

The product itself is good however this company has a terrible service.
Run Code Online (Sandbox Code Playgroud)

标记

The/DT product/NN itself/PRP is/VBZ good/JJ however/RB this/DT company/NN has/VBZ a/DT terrible/JJ service/NN ./.
Run Code Online (Sandbox Code Playgroud)

解析

(ROOT
  (S
    (NP (DT The) (NN product))
    (ADVP (PRP itself))
    (VP (VBZ is)
      (ADJP (JJ good))
      (SBAR
        (WHADVP (RB however))
        (S
          (NP (DT this) (NN company))
          (VP (VBZ has)
            (NP (DT a) (JJ terrible) (NN service))))))
    (. .)))
Run Code Online (Sandbox Code Playgroud)

普遍依赖

det(product-2, The-1)
nsubj(good-5, product-2)
advmod(good-5, itself-3)
cop(good-5, is-4)
root(ROOT-0, good-5)
advmod(has-9, however-6)
det(company-8, this-7)
nsubj(has-9, company-8)
dep(good-5, has-9)
det(service-12, a-10)
amod(service-12, terrible-11)
dobj(has-9, service-12)
Run Code Online (Sandbox Code Playgroud)