spaCy/spacy/__init__.py

45 lines
1.1 KiB
Python
Raw Normal View History

from .util import set_lang_class, get_lang_class
from . import en
from . import de
from . import zh
2016-11-02 19:05:14 +00:00
from . import es
from . import it
2016-12-21 19:45:36 +00:00
from . import hu
2016-11-02 19:48:29 +00:00
from . import fr
2016-11-02 19:05:14 +00:00
from . import pt
2016-11-24 15:39:49 +00:00
from . import nl
2016-12-20 10:05:06 +00:00
from . import sv
2017-01-31 22:27:29 +00:00
from . import fi
2017-02-28 01:48:37 +00:00
from . import bn
2016-09-24 20:09:21 +00:00
try:
2016-09-24 20:17:01 +00:00
basestring
2016-09-24 20:09:21 +00:00
except NameError:
2016-09-24 20:17:01 +00:00
basestring = str
2016-09-24 20:09:21 +00:00
set_lang_class(en.English.lang, en.English)
set_lang_class(de.German.lang, de.German)
2016-11-02 19:05:14 +00:00
set_lang_class(es.Spanish.lang, es.Spanish)
set_lang_class(pt.Portuguese.lang, pt.Portuguese)
set_lang_class(fr.French.lang, fr.French)
set_lang_class(it.Italian.lang, it.Italian)
set_lang_class(hu.Hungarian.lang, hu.Hungarian)
set_lang_class(zh.Chinese.lang, zh.Chinese)
2016-11-29 15:42:05 +00:00
set_lang_class(nl.Dutch.lang, nl.Dutch)
2016-12-20 10:05:06 +00:00
set_lang_class(sv.Swedish.lang, sv.Swedish)
2017-01-31 22:27:29 +00:00
set_lang_class(fi.Finnish.lang, fi.Finnish)
2017-02-28 01:48:37 +00:00
set_lang_class(bn.Bengali.lang, bn.Bengali)
2017-01-31 22:27:29 +00:00
2016-03-25 17:54:45 +00:00
2016-10-18 17:23:31 +00:00
def load(name, **overrides):
target_name, target_version = util.split_data_name(name)
data_path = overrides.get('path', util.get_data_path())
path = util.match_best_version(target_name, target_version, data_path)
2016-09-24 18:26:17 +00:00
cls = get_lang_class(target_name)
2016-12-18 21:15:29 +00:00
overrides['path'] = path
return cls(**overrides)