Add collapse_phrases option to displacy (closes #2266)

This commit is contained in:
ines 2018-04-28 23:06:50 +02:00
parent 87cc6b3599
commit 6fb6371670
2 changed files with 10 additions and 0 deletions

View File

@ -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]:

View File

@ -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