mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
Merge branch 'master' of ssh://github.com/honnibal/spaCy
This commit is contained in:
commit
0f957dd586
7
setup.py
7
setup.py
|
@ -72,7 +72,7 @@ MOD_NAMES = [
|
|||
# which is really known only after finalize_options
|
||||
# http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used
|
||||
compile_options = {
|
||||
'msvc': ['/Ox', '/EHsc', '/openmp'],
|
||||
'msvc': ['/Ox', '/EHsc'],
|
||||
'mingw32' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function'],
|
||||
'other' : ['-O3', '-Wno-strict-prototypes', '-Wno-unused-function']
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ link_options = {
|
|||
}
|
||||
|
||||
|
||||
if os.environ.get('USE_OPENMP') == '1':
|
||||
compile_options['msvc'].append('/openmp')
|
||||
|
||||
|
||||
if not sys.platform.startswith('darwin'):
|
||||
compile_options['other'].append('-fopenmp')
|
||||
link_options['other'].append('-fopenmp')
|
||||
|
@ -189,7 +193,6 @@ def setup_package():
|
|||
'thinc>=5.0.0,<5.1.0',
|
||||
'plac',
|
||||
'six',
|
||||
'ujson',
|
||||
'cloudpickle',
|
||||
'sputnik>=0.9.2,<0.10.0'],
|
||||
classifiers=[
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
from .util import set_lang_class, get_lang_class, get_package, get_package_by_name
|
||||
|
||||
from .en import English
|
||||
from .de import German
|
||||
from . import en
|
||||
from . import de
|
||||
|
||||
|
||||
set_lang_class(English.lang, English)
|
||||
set_lang_class(German.lang, German)
|
||||
set_lang_class(en.English.lang, en.English)
|
||||
set_lang_class(de.German.lang, de.German)
|
||||
|
||||
|
||||
def load(name, vectors=None, via=None):
|
||||
|
|
|
@ -14,4 +14,3 @@ __models__ = {
|
|||
'en': 'en>=1.1.0,<1.2.0',
|
||||
'de': 'de>=1.0.0,<1.1.0',
|
||||
}
|
||||
__default_lang__ = 'en'
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import numpy
|
||||
import io
|
||||
import json
|
||||
import ujson
|
||||
import random
|
||||
import re
|
||||
import os
|
||||
|
|
|
@ -20,6 +20,7 @@ from .syntax.ner import BiluoPushDown
|
|||
from .syntax.arc_eager import ArcEager
|
||||
|
||||
from . import util
|
||||
from . import about
|
||||
from .attrs import TAG, DEP, ENT_IOB, ENT_TYPE, HEAD
|
||||
|
||||
|
||||
|
@ -166,7 +167,7 @@ class Language(object):
|
|||
"""
|
||||
if package is None:
|
||||
if data_dir is None:
|
||||
package = util.get_package_by_name()
|
||||
package = util.get_package_by_name(about.__models__[self.lang])
|
||||
else:
|
||||
package = util.get_package(data_dir)
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ from preshed.maps cimport map_iter, key_t
|
|||
|
||||
from .typedefs cimport hash_t
|
||||
|
||||
import ujson as json
|
||||
try:
|
||||
import ujson as json
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
|
||||
cpdef hash_t hash_string(unicode string) except 0:
|
||||
|
|
|
@ -24,7 +24,7 @@ from spacy.serialize.bits import BitArray
|
|||
def vocab():
|
||||
data_dir = os.environ.get('SPACY_DATA')
|
||||
if data_dir is None:
|
||||
package = util.get_package_by_name()
|
||||
package = util.get_package_by_name('en')
|
||||
else:
|
||||
package = util.get_package(data_dir)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import pytest
|
|||
def package():
|
||||
data_dir = os.environ.get('SPACY_DATA')
|
||||
if data_dir is None:
|
||||
return util.get_package_by_name()
|
||||
return util.get_package_by_name('en')
|
||||
else:
|
||||
return util.get_package(data_dir)
|
||||
|
||||
|
|
|
@ -36,11 +36,12 @@ def get_package(data_dir):
|
|||
|
||||
|
||||
def get_package_by_name(name=None, via=None):
|
||||
package_name = name or about.__models__[about.__default_lang__]
|
||||
lang = get_lang_class(package_name)
|
||||
if name is None:
|
||||
return
|
||||
lang = get_lang_class(name)
|
||||
try:
|
||||
return sputnik.package(about.__title__, about.__version__,
|
||||
package_name, data_path=via)
|
||||
name, data_path=via)
|
||||
except PackageNotFoundException as e:
|
||||
raise RuntimeError("Model '%s' not installed. Please run 'python -m "
|
||||
"%s.download' to install latest compatible "
|
||||
|
|
Loading…
Reference in New Issue
Block a user