Reputation: 1
Image of Dependency Tree
Considering the image above, I would like to have the xcomp arrow to be removed when rendered, is it possible to do this kind of customization?
I understood how to change its style, but not how to suppress relationships if needed (for educational purposes).
Upvotes: 0
Views: 61
Reputation: 11484
Unset the dependency label in the underlying parse:
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("This is a sentence")
for token in doc:
if token.dep_ == "nsubj":
token.dep_ = ""
spacy.displacy.serve(doc)
Upvotes: 0