mirror of https://github.com/explosion/spaCy.git
Remove usage of itertools.islice
This commit is contained in:
parent
3df26d820f
commit
ea00dbaaa4
|
@ -9,6 +9,7 @@ import numpy
|
||||||
cimport cython.parallel
|
cimport cython.parallel
|
||||||
import numpy.random
|
import numpy.random
|
||||||
cimport numpy as np
|
cimport numpy as np
|
||||||
|
from itertools import islice
|
||||||
from cpython.ref cimport PyObject, Py_XDECREF
|
from cpython.ref cimport PyObject, Py_XDECREF
|
||||||
from cpython.exc cimport PyErr_CheckSignals, PyErr_SetFromErrno
|
from cpython.exc cimport PyErr_CheckSignals, PyErr_SetFromErrno
|
||||||
from libc.math cimport exp
|
from libc.math cimport exp
|
||||||
|
@ -515,7 +516,7 @@ cdef class Parser:
|
||||||
sgd = self.create_optimizer()
|
sgd = self.create_optimizer()
|
||||||
doc_sample = []
|
doc_sample = []
|
||||||
gold_sample = []
|
gold_sample = []
|
||||||
for raw_text, annots_brackets in cytoolz.take(1000, get_gold_tuples()):
|
for raw_text, annots_brackets in islice(get_gold_tuples(), 1000):
|
||||||
for annots, brackets in annots_brackets:
|
for annots, brackets in annots_brackets:
|
||||||
ids, words, tags, heads, deps, ents = annots
|
ids, words, tags, heads, deps, ents = annots
|
||||||
doc_sample.append(Doc(self.vocab, words=words))
|
doc_sample.append(Doc(self.vocab, words=words))
|
||||||
|
|
Loading…
Reference in New Issue