mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-21 01:21:58 +03:00
Add vectors registry
This commit is contained in:
parent
808cc947fa
commit
ffbc4af216
|
@ -27,7 +27,7 @@ batch_size = 1000
|
|||
@tokenizers = "spacy.Tokenizer.v1"
|
||||
|
||||
[nlp.vectors]
|
||||
@misc = "spacy.Vectors.v1"
|
||||
@vectors = "spacy.Vectors.v1"
|
||||
|
||||
# The pipeline components and their models
|
||||
[components]
|
||||
|
|
|
@ -1774,7 +1774,7 @@ class Language:
|
|||
# fill in [nlp.vectors] if not present (as a narrower alternative to
|
||||
# auto-filling [nlp] from the default config)
|
||||
if "vectors" not in config["nlp"]:
|
||||
config["nlp"]["vectors"] = {"@misc": "spacy.Vectors.v1"}
|
||||
config["nlp"]["vectors"] = {"@vectors": "spacy.Vectors.v1"}
|
||||
config_lang = config["nlp"].get("lang")
|
||||
if config_lang is not None and config_lang != cls.lang:
|
||||
raise ValueError(
|
||||
|
|
|
@ -118,6 +118,7 @@ class registry(thinc.registry):
|
|||
augmenters = catalogue.create("spacy", "augmenters", entry_points=True)
|
||||
loggers = catalogue.create("spacy", "loggers", entry_points=True)
|
||||
scorers = catalogue.create("spacy", "scorers", entry_points=True)
|
||||
vectors = catalogue.create("spacy", "vectors", entry_points=True)
|
||||
# These are factories registered via third-party packages and the
|
||||
# spacy_factories entry point. This registry only exists so we can easily
|
||||
# load them via the entry points. The "true" factories are added via the
|
||||
|
|
|
@ -98,7 +98,7 @@ cdef class BaseVectors:
|
|||
return self
|
||||
|
||||
|
||||
@util.registry.misc("spacy.Vectors.v1")
|
||||
@util.registry.vectors("spacy.Vectors.v1")
|
||||
def create_mode_vectors() -> Callable[["Vocab"], BaseVectors]:
|
||||
def vectors_factory(vocab: "Vocab") -> BaseVectors:
|
||||
return Vectors(strings=vocab.strings)
|
||||
|
|
Loading…
Reference in New Issue
Block a user