Adjust formatting

This commit is contained in:
Ines Montani 2021-07-17 10:49:13 +10:00 committed by GitHub
parent eff3d1088b
commit 15e6578f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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])