mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-13 05:07:03 +03:00
Adjust formatting
This commit is contained in:
parent
eff3d1088b
commit
15e6578f7d
|
@ -188,9 +188,8 @@ def test_ngram_suggester(en_tokenizer):
|
||||||
def test_ngram_sizes(en_tokenizer):
|
def test_ngram_sizes(en_tokenizer):
|
||||||
# test that the range suggester works well
|
# test that the range suggester works well
|
||||||
size_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2, 3])
|
size_suggester = registry.misc.get("spacy.ngram_suggester.v1")(sizes=[1, 2, 3])
|
||||||
range_suggester = registry.misc.get("spacy.ngram_range_suggester.v1")(
|
suggester_factory = registry.misc.get("spacy.ngram_range_suggester.v1")
|
||||||
min_size=1, max_size=3
|
range_suggester = suggester_factory(min_size=1, max_size=3)
|
||||||
)
|
|
||||||
docs = [
|
docs = [
|
||||||
en_tokenizer(text) for text in ["a", "a b", "a b c", "a b c d", "a b c d e"]
|
en_tokenizer(text) for text in ["a", "a b", "a b c", "a b c d", "a b c d e"]
|
||||||
]
|
]
|
||||||
|
@ -201,8 +200,7 @@ def test_ngram_sizes(en_tokenizer):
|
||||||
assert_equal(ngrams_1.data, ngrams_2.data)
|
assert_equal(ngrams_1.data, ngrams_2.data)
|
||||||
|
|
||||||
# one more variation
|
# one more variation
|
||||||
range_suggester = registry.misc.get("spacy.ngram_range_suggester.v1")(
|
suggester_factory = registry.misc.get("spacy.ngram_range_suggester.v1")
|
||||||
min_size=2, max_size=4
|
range_suggester = suggester_factory(min_size=2, max_size=4)
|
||||||
)
|
|
||||||
ngrams_3 = range_suggester(docs)
|
ngrams_3 = range_suggester(docs)
|
||||||
assert_equal(ngrams_3.lengths, [0, 1, 3, 6, 9])
|
assert_equal(ngrams_3.lengths, [0, 1, 3, 6, 9])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user