diff --git a/spacy/tests/util.py b/spacy/tests/util.py index 9f7300c7e..385ff414b 100644 --- a/spacy/tests/util.py +++ b/spacy/tests/util.py @@ -4,9 +4,20 @@ from __future__ import unicode_literals from ..tokens import Doc from ..attrs import ORTH, POS, HEAD, DEP +import pytest import numpy +MODELS = {} + + +def load_test_model(model): + if model not in MODELS: + module = pytest.importorskip(model) + MODELS[model] = module.load() + return MODELS[model] + + def get_doc(vocab, words=[], pos=None, heads=None, deps=None, tags=None, ents=None): """Create Doc object from given vocab, words and annotations.""" pos = pos or [''] * len(words)