register extract_ngrams layer (#8358)

* register extract_ngrams layer

* fix import

* bump spacy-legacy to 3.0.6

* revert bump (wrong PR)
This commit is contained in:
Sofie Van Landeghem 2021-06-14 10:30:30 +02:00 committed by GitHub
parent 3259faad42
commit 8729307e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -1,8 +1,10 @@
from thinc.api import Model
from ..util import registry
from ..attrs import LOWER
@registry.layers("spacy.extract_ngrams.v1")
def extract_ngrams(ngram_size: int, attr: int = LOWER) -> Model:
model = Model("extract_ngrams", forward)
model.attrs["ngram_size"] = ngram_size