Fix style check in displacy

This commit is contained in:
Matthew Honnibal 2017-05-17 07:57:24 -05:00
parent 55dab77de8
commit 0b7fd67408

View File

@ -22,12 +22,14 @@ def render(docs, style='dep', page=False, minify=False, jupyter=False, options={
""" """
if isinstance(docs, Doc): if isinstance(docs, Doc):
docs = [docs] docs = [docs]
if style is 'dep': if style == 'dep':
renderer = DependencyRenderer(options=options) renderer = DependencyRenderer(options=options)
parsed = [parse_deps(doc, options) for doc in docs] parsed = [parse_deps(doc, options) for doc in docs]
elif style is 'ent': elif style == 'ent':
renderer = EntityRenderer(options=options) renderer = EntityRenderer(options=options)
parsed = [parse_ents(doc, options) for doc in docs] parsed = [parse_ents(doc, options) for doc in docs]
else:
raise ValueError("Unknown style: %s" % style)
_html['parsed'] = renderer.render(parsed, page=page, minify=minify).strip() _html['parsed'] = renderer.render(parsed, page=page, minify=minify).strip()
html = _html['parsed'] html = _html['parsed']
if jupyter: # return HTML rendered by IPython display() if jupyter: # return HTML rendered by IPython display()