mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
fix name clash
This commit is contained in:
parent
2bf5111ecf
commit
c5ac382f0a
|
@ -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
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user