fix name clash

This commit is contained in:
svlandeg 2020-06-02 22:24:57 +02:00
parent 2bf5111ecf
commit c5ac382f0a
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import pytest import pytest
from spacy.gold import Example from spacy.gold import Example
from .util import get_doc from .util import get_random_doc
from spacy.util import minibatch_by_words from spacy.util import minibatch_by_words
@ -24,7 +24,7 @@ from spacy.util import minibatch_by_words
], ],
) )
def test_util_minibatch(doc_sizes, expected_batches): def test_util_minibatch(doc_sizes, expected_batches):
docs = [get_doc(doc_size) for doc_size in doc_sizes] docs = [get_random_doc(doc_size) for doc_size in doc_sizes]
examples = [Example(doc=doc) for doc in docs] examples = [Example(doc=doc) for doc in docs]
tol = 0.2 tol = 0.2
batch_size = 1000 batch_size = 1000
@ -49,7 +49,7 @@ def test_util_minibatch(doc_sizes, expected_batches):
) )
def test_util_minibatch_oversize(doc_sizes, expected_batches): def test_util_minibatch_oversize(doc_sizes, expected_batches):
""" Test that oversized documents are returned in their own batch""" """ Test that oversized documents are returned in their own batch"""
docs = [get_doc(doc_size) for doc_size in doc_sizes] docs = [get_random_doc(doc_size) for doc_size in doc_sizes]
examples = [Example(doc=doc) for doc in docs] examples = [Example(doc=doc) for doc in docs]
tol = 0.2 tol = 0.2
batch_size = 1000 batch_size = 1000

View File

@ -92,7 +92,7 @@ def get_batch(batch_size):
return docs return docs
def get_doc(n_words): def get_random_doc(n_words):
vocab = Vocab() vocab = Vocab()
# Make the words numbers, so that they're easy to track. # Make the words numbers, so that they're easy to track.
numbers = [str(i) for i in range(0, n_words)] numbers = [str(i) for i in range(0, n_words)]