diff --git a/spacy/displacy/__init__.py b/spacy/displacy/__init__.py index fb6487305..a3c6a5a94 100644 --- a/spacy/displacy/__init__.py +++ b/spacy/displacy/__init__.py @@ -86,6 +86,10 @@ def parse_deps(orig_doc, options={}): doc = Doc(orig_doc.vocab).from_bytes(orig_doc.to_bytes()) if not doc.is_parsed: user_warning(Warnings.W005) + if options.get('collapse_phrases', False): + for np in list(doc.noun_chunks): + np.merge(tag=np.root.tag_, lemma=np.root.lemma_, + ent_type=np.root.ent_type_) if options.get('collapse_punct', True): spans = [] for word in doc[:-1]: diff --git a/website/api/_top-level/_displacy.jade b/website/api/_top-level/_displacy.jade index 105bb0cc6..7fcf3d464 100644 --- a/website/api/_top-level/_displacy.jade +++ b/website/api/_top-level/_displacy.jade @@ -157,6 +157,12 @@ p | as it prevents long arcs to attach punctuation. +cell #[code True] + +row + +cell #[code collapse_phrases] + +cell bool + +cell Merge base noun phrases into one token. + +cell #[code False] + +row +cell #[code compact] +cell bool