mirror of https://github.com/explosion/spaCy.git
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:
parent
3259faad42
commit
8729307e67
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue