Background
I would like to know how to separate nouns and their decorations, such as articles and possessive cases.
Example
#sentence
The man with the star regarded her with his expressionless eyes.
# what to extract
man
star
eyes
Problem
As the below image created using disPlacy tool, "The man, the star, and his expressionless eyes" are united as NOUN.
the visualizar of part of speech and dependencies
https://explosion.ai/demos/displacy
What I tried
I've run the sample code introduced on the spaCy page.
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("The man with the star regarded her with his calm, expressionless eyes.")
for token in doc:
print(token.text, token.dep_, token.head.text, token.head.pos_,
[child for child in token.children])
Using the below result or other ways, how can I extract nouns themselves excluding their articles and possessive case?
$ python sample.py
The det man NOUN []
man nsubj regarded VERB [The, with]
with prep man NOUN [star]
the det star NOUN []
star pobj with ADP [the]
regarded ROOT regarded VERB [man, her, with, .]
her dobj regarded VERB []
with prep regarded VERB [eyes]
his poss eyes NOUN []
calm amod eyes NOUN [,]
, punct calm ADJ []
expressionless amod eyes NOUN []
eyes pobj with ADP [his, calm, expressionless]
. punct regarded VERB []
