How to get an object representation of dependencies? #10297
-
Hey, SpaCy comes with a nice dependency parser and visualiser. However I'm struggling to find out how I can get an object based representation for the dependencies in a sentence. Using The docs show how we can input this representation to be displayed: https://spacy.io/usage/visualizers#manual-usage, but doesn't mention how we can extract that representation from spacy's nlp (or displacy) itself |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found the answer. from spacy.displacy import parse_deps
doc = "This is a document"
spacy_doc = nlp(doc)
print(parse_deps(spacy_doc)) |
Beta Was this translation helpful? Give feedback.
Found the answer.