mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
* Fix test that was failing on travis
This commit is contained in:
parent
329ae57520
commit
7673e3a32c
|
@ -25,28 +25,34 @@ from thinc.learner import LinearModel
|
|||
|
||||
class TestLoadVocab(unittest.TestCase):
|
||||
def test_load(self):
|
||||
vocab = Vocab.from_dir(path.join(English.default_data_dir(), 'vocab'))
|
||||
if path.exists(path.join(English.default_data_dir(), 'vocab')):
|
||||
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'))
|
||||
if path.exists(path.join(data_dir, 'vocab')):
|
||||
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)
|
||||
|
||||
if path.exists(path.join(data_dir, 'vocab')):
|
||||
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 path.exists(path.join(data_dir, 'vocab')):
|
||||
vocab = Vocab.from_dir(path.join(data_dir, 'vocab'))
|
||||
if path.exists(path.join(data_dir, 'deps')):
|
||||
parser = Parser.from_dir(path.join(data_dir, 'deps'), vocab.strings, ArcEager)
|
||||
|
||||
def test_load_careful(self):
|
||||
config_data = {"labels": {"0": {"": True}, "1": {"": True}, "2": {"cc": True, "agent": True, "ccomp": True, "prt": True, "meta": True, "nsubjpass": True, "csubj": True, "conj": True, "dobj": True, "neg": True, "csubjpass": True, "mark": True, "auxpass": True, "advcl": True, "aux": True, "ROOT": True, "prep": True, "parataxis": True, "xcomp": True, "nsubj": True, "nummod": True, "advmod": True, "punct": True, "relcl": True, "quantmod": True, "acomp": True, "compound": True, "pcomp": True, "intj": True, "poss": True, "npadvmod": True, "case": True, "attr": True, "dep": True, "appos": True, "det": True, "nmod": True, "amod": True, "dative": True, "pobj": True, "expl": True, "predet": True, "preconj": True, "oprd": True, "acl": True}, "3": {"cc": True, "agent": True, "ccomp": True, "prt": True, "meta": True, "nsubjpass": True, "csubj": True, "conj": True, "acl": True, "poss": True, "neg": True, "mark": True, "auxpass": True, "advcl": True, "aux": True, "amod": True, "ROOT": True, "prep": True, "parataxis": True, "xcomp": True, "nsubj": True, "nummod": True, "advmod": True, "punct": True, "quantmod": True, "acomp": True, "pcomp": True, "intj": True, "relcl": True, "npadvmod": True, "case": True, "attr": True, "dep": True, "appos": True, "det": True, "nmod": True, "dobj": True, "dative": True, "pobj": True, "iobj": True, "expl": True, "predet": True, "preconj": True, "oprd": True}, "4": {"ROOT": True}}, "seed": 0, "features": "basic", "beam_width": 1}
|
||||
|
@ -67,8 +73,9 @@ class TestLoadParser(unittest.TestCase):
|
|||
|
||||
# n classes. moves.n_moves above
|
||||
# n features. len(templates) + 1 above
|
||||
model = LinearModel(92, 116)
|
||||
model.load(model_loc)
|
||||
if path.exists(model_loc):
|
||||
model = LinearModel(92, 116)
|
||||
model.load(model_loc)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue
Block a user