mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 09:26:27 +03:00
* Make minor efficiency improvement in Doc.__iter__
This commit is contained in:
parent
cd91914dd8
commit
ced59ab9ea
|
@ -134,7 +134,11 @@ cdef class Doc:
|
||||||
Yields:
|
Yields:
|
||||||
token (Token):
|
token (Token):
|
||||||
"""
|
"""
|
||||||
|
cdef int i
|
||||||
for i in range(self.length):
|
for i in range(self.length):
|
||||||
|
if self._py_tokens[i] is not None:
|
||||||
|
yield self._py_tokens[i]
|
||||||
|
else:
|
||||||
yield Token.cinit(self.vocab, &self.data[i], i, self)
|
yield Token.cinit(self.vocab, &self.data[i], i, self)
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user