mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Update spacy.explain docs
This commit is contained in:
parent
96b4214303
commit
9bf78d5fb3
|
@ -3,6 +3,16 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
def explain(term):
|
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:
|
if term in GLOSSARY:
|
||||||
return GLOSSARY[term]
|
return GLOSSARY[term]
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ p
|
||||||
| #[+src(gh("spacy", "spacy/glossary.py")) #[code glossary.py]].
|
| #[+src(gh("spacy", "spacy/glossary.py")) #[code glossary.py]].
|
||||||
|
|
||||||
+aside-code("Example").
|
+aside-code("Example").
|
||||||
spacy.explain('NORP')
|
spacy.explain(u'NORP')
|
||||||
# Nationalities or religious or political groups
|
# Nationalities or religious or political groups
|
||||||
|
|
||||||
doc = nlp(u'Hello world')
|
doc = nlp(u'Hello world')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user