mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
* Add docstring for ents attribute
This commit is contained in:
parent
ec42b06a8d
commit
ca320afe86
|
@ -143,7 +143,17 @@ cdef class Tokens:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ents(self):
|
def ents(self):
|
||||||
"""Yields named-entity Span objects."""
|
"""Yields named-entity Span objects.
|
||||||
|
|
||||||
|
Iterate over the span to get individual Token objects, or access the label:
|
||||||
|
|
||||||
|
>>> from spacy.en import English
|
||||||
|
>>> nlp = English()
|
||||||
|
>>> tokens = nlp(u'Mr. Best flew to New York on Saturday morning.')
|
||||||
|
>>> ents = list(tokens.ents)
|
||||||
|
>>> ents[0].label, ents[0].label_, ''.join(t.orth_ for t in ents[0])
|
||||||
|
(112504, u'PERSON', u'Best ')
|
||||||
|
"""
|
||||||
cdef int i
|
cdef int i
|
||||||
cdef const TokenC* token
|
cdef const TokenC* token
|
||||||
cdef int start = -1
|
cdef int start = -1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user