Update spacy.explain docs

This commit is contained in:
ines 2017-10-26 13:04:25 +02:00
parent 96b4214303
commit 9bf78d5fb3
2 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,16 @@ from __future__ import unicode_literals
def explain(term):
"""Get a description for a given POS tag, dependency label or entity type.
term (unicode): The term to explain.
RETURNS (unicode): The explanation, or `None` if not found in the glossary.
EXAMPLE:
>>> spacy.explain(u'NORP')
>>> doc = nlp(u'Hello world')
>>> print([w.text, w.tag_, spacy.explain(w.tag_) for w in doc])
"""
if term in GLOSSARY:
return GLOSSARY[term]

View File

@ -136,7 +136,7 @@ p
| #[+src(gh("spacy", "spacy/glossary.py")) #[code glossary.py]].
+aside-code("Example").
spacy.explain('NORP')
spacy.explain(u'NORP')
# Nationalities or religious or political groups
doc = nlp(u'Hello world')