mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 10:26:35 +03:00
Merge remote-tracking branch 'refs/remotes/honnibal/master'
This commit is contained in:
commit
356181944a
50
tests/test_basic_load.py
Normal file
50
tests/test_basic_load.py
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
"""Some quick tests that don't depend on data files or on pytest, for debugging the
|
||||||
|
MS windows build issues."""
|
||||||
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import re
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
from spacy.lemmatizer import Lemmatizer
|
||||||
|
from spacy.morphology import Morphology
|
||||||
|
from spacy.strings import StringStore
|
||||||
|
from spacy.vocab import Vocab
|
||||||
|
from spacy.tokenizer import Tokenizer
|
||||||
|
from spacy.syntax.arc_eager import ArcEager
|
||||||
|
from spacy._ml import Model
|
||||||
|
from spacy.tagger import Tagger
|
||||||
|
from spacy.syntax.parser import Parser
|
||||||
|
from spacy.matcher import Matcher
|
||||||
|
|
||||||
|
from spacy.en import English
|
||||||
|
|
||||||
|
|
||||||
|
class TestLoadVocab(unittest.TestCase):
|
||||||
|
def test_load(self):
|
||||||
|
vocab = Vocab.from_dir(path.join(English.default_data_dir(), 'vocab'))
|
||||||
|
|
||||||
|
|
||||||
|
class TestLoadTokenizer(unittest.TestCase):
|
||||||
|
def test_load(self):
|
||||||
|
data_dir = English.default_data_dir()
|
||||||
|
vocab = Vocab.from_dir(path.join(data_dir, 'vocab'))
|
||||||
|
tokenizer = Tokenizer.from_dir(vocab, path.join(data_dir, 'tokenizer'))
|
||||||
|
|
||||||
|
|
||||||
|
class TestLoadTagger(unittest.TestCase):
|
||||||
|
def test_load(self):
|
||||||
|
data_dir = English.default_data_dir()
|
||||||
|
vocab = Vocab.from_dir(path.join(data_dir, 'vocab'))
|
||||||
|
tagger = Tagger.from_dir(path.join(data_dir, 'tagger'), vocab)
|
||||||
|
|
||||||
|
|
||||||
|
class TestLoadParser(unittest.TestCase):
|
||||||
|
def test_load(self):
|
||||||
|
data_dir = English.default_data_dir()
|
||||||
|
vocab = Vocab.from_dir(path.join(data_dir, 'vocab'))
|
||||||
|
parser = Parser.from_dir(path.join(data_dir, 'deps'), vocab.strings, ArcEager)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Reference in New Issue
Block a user