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