Reputation: 133
I need a method / algorithm for identifying which adjective is related to which noun in a sentence.
Sample input:
"The product itself is good however this company has a terrible service"
As an output i'd like to get something like:
[product, good]
[service, terrible]
Could you please point me some algorithms / libraries that would help with such task?
Upvotes: 1
Views: 1373
Reputation: 37731
You can use Stanford dependency parser, also this relevant paper. You can check their online tool as well. For example, for your sentence, you can get the following from Stanford parser.
Your query
The product itself is good however this company has a terrible service.
Tagging
The/DT product/NN itself/PRP is/VBZ good/JJ however/RB this/DT company/NN has/VBZ a/DT terrible/JJ service/NN ./.
Parse
(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))))))
(. .)))
Universal dependencies
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)
Upvotes: 3