How to get a 'dobj' in spacy -


in following tweet spacy dependency tagger states disrupt (vb) dobj of healthcare market (nn). these 2 terms connected extract them 1 phrase. there way navigate parse tree can extract dobj of word? if folllowing market not 'heathcare market'

from spacy.en import english spacy.symbols import nsubj, verb,dobj  nlp = english() doc = nlp('juniper research: ai start-ups set disrupt healthcare market, $800 million spent on cad systems 2022')  possible_subject in doc: if possible_subject.dep == dobj:     print(possible_subject.text) 

you can below using noun chunks

for np in doc.noun_chunks:     if np.root.dep == dobj:         print(np.root.text)         print(np.text) 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -