diff --git a/requirements.txt b/requirements.txt index 8964308d4..89834ee05 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ cython cymem>=1.30,<1.31 pathlib preshed>=0.46.1,<0.47.0 -thinc>=4.2.0,<4.3.0 +thinc>=5.0.0,<5.1.0 murmurhash>=0.26,<0.27 text-unidecode numpy diff --git a/setup.py b/setup.py index f92f8c50b..a177db5fa 100644 --- a/setup.py +++ b/setup.py @@ -79,6 +79,9 @@ if sys.platform.startswith('darwin'): compile_options['other'].append('-mmacosx-version-min=10.8') compile_options['other'].append('-stdlib=libc++') link_options['other'].append('-lc++') +else: + compile_options['other'].append('-fopenmp') + link_options['other'].append('-fopenmp') class build_ext_options: diff --git a/spacy/language.py b/spacy/language.py index 58d137e2e..36a56413a 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -271,20 +271,20 @@ class Language(object): def pipe(self, texts, tag=True, parse=True, entity=True, n_threads=2, batch_size=1000): - stream = self.tokenizer.stream(texts, + stream = self.tokenizer.pipe(texts, n_threads=n_threads, batch_size=batch_size) if self.tagger and tag: - stream = self.tagger.stream(stream, + stream = self.tagger.pipe(stream, n_threads=n_threads, batch_size=batch_size) if self.matcher and entity: - stream = self.matcher.stream(stream, + stream = self.matcher.pipe(stream, n_threads=n_threads, batch_size=batch_size) if self.parser and parse: - stream = self.parser.stream(stream, + stream = self.parser.pipe(stream, n_threads=n_threads, batch_size=batch_size) if self.entity and entity: - stream = self.entity.stream(stream, - n_threads=n_threads, batch_size=batch_size) + stream = self.entity.pipe(stream, + n_threads=1, batch_size=batch_size) for doc in stream: yield doc diff --git a/spacy/syntax/parser.pyx b/spacy/syntax/parser.pyx index 40f010f4a..c62ba6c6f 100644 --- a/spacy/syntax/parser.pyx +++ b/spacy/syntax/parser.pyx @@ -4,6 +4,7 @@ MALT-style dependency parser """ from __future__ import unicode_literals cimport cython +cimport cython.parallel from cpython.ref cimport PyObject, Py_INCREF, Py_XDECREF from cpython.exc cimport PyErr_CheckSignals