Reputation: 596
For sentence such as : "Replaced both carbonator float switch and pressure relief valve."
i would like to extract the following : {replaced carbonator float switch} , {replaced pressure relief valve}
while using Spacy for the language model , my dependency tree for that sentence is :
So i know that carbonator is the direct object (djob) of Replaced (verb) , but : 1. carbonator is not on itself , but is part of the triple NOUN "carbonator float switch" , and also "pressure releif valve" is been replaced , they should also be directed object of replaced.
Any ideas ?
Upvotes: 1
Views: 1590
Reputation: 11424
It seems that the problem is not in extracting compounds from the tree, but in the parsing itself: it is just incorrect. Probably, Spacy dependency parser just hasn't been trained on such technical terms as "carbonator float switch" and "pressure relief valve", and doesn't know how they group together.
Maybe you need to look for other dependency parsers (e.g. Stanford CoreNLP - it makes a correct parse, as shown in the picture). Or if you really really need Spacy, you may want to collect and label your own training data, and fine tune the Spacy parser on it.
Upvotes: 4