spaCy/spacy/tests/website/conftest.py

21 lines
500 B
Python
Raw Normal View History

2015-09-28 12:22:13 +00:00
from __future__ import unicode_literals
import pytest
import os
2015-09-28 12:22:13 +00:00
@pytest.fixture(scope='session')
def nlp():
2015-12-07 05:01:28 +00:00
from spacy.en import English
if os.environ.get('SPACY_DATA'):
2016-01-16 11:23:45 +00:00
data_dir = os.environ.get('SPACY_DATA')
else:
2016-10-16 23:54:26 +00:00
data_dir = True
return English(path=data_dir)
2015-09-28 12:22:13 +00:00
@pytest.fixture()
def doc(nlp):
for word in ['Hello', ',', 'world', '.', 'Here', 'are', 'two', 'sentences', '.']:
_ = nlp.vocab[word]
2015-09-28 12:22:13 +00:00
return nlp('Hello, world. Here are two sentences.')