mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Update formatting and docstrings [ci skip]
This commit is contained in:
parent
ddd6fda59c
commit
c4f95c1569
|
@ -496,7 +496,8 @@ class Errors(object):
|
||||||
E173 = ("As of v2.2, the Lemmatizer is initialized with an instance of "
|
E173 = ("As of v2.2, the Lemmatizer is initialized with an instance of "
|
||||||
"Lookups containing the lemmatization tables. See the docs for "
|
"Lookups containing the lemmatization tables. See the docs for "
|
||||||
"details: https://spacy.io/api/lemmatizer#init")
|
"details: https://spacy.io/api/lemmatizer#init")
|
||||||
E174 = ("Architecture {name} not found in registry. Available names: {names}")
|
E174 = ("Architecture '{name}' not found in registry. Available "
|
||||||
|
"names: {names}")
|
||||||
|
|
||||||
|
|
||||||
@add_codes
|
@add_codes
|
||||||
|
|
|
@ -124,6 +124,11 @@ def set_data_path(path):
|
||||||
def register_architecture(name, arch=None):
|
def register_architecture(name, arch=None):
|
||||||
"""Decorator to register an architecture. An architecture is a function
|
"""Decorator to register an architecture. An architecture is a function
|
||||||
that returns a Thinc Model object.
|
that returns a Thinc Model object.
|
||||||
|
|
||||||
|
name (unicode): The name of the architecture to register.
|
||||||
|
arch (Model): Optional architecture if function is called directly and
|
||||||
|
not used as a decorator.
|
||||||
|
RETURNS (callable): Function to register architecture.
|
||||||
"""
|
"""
|
||||||
global ARCHITECTURES
|
global ARCHITECTURES
|
||||||
if arch is not None:
|
if arch is not None:
|
||||||
|
@ -138,7 +143,12 @@ def register_architecture(name, arch=None):
|
||||||
|
|
||||||
|
|
||||||
def get_architecture(name):
|
def get_architecture(name):
|
||||||
"""Get a model architecture function by name."""
|
"""Get a model architecture function by name. Raises a KeyError if the
|
||||||
|
architecture is not found.
|
||||||
|
|
||||||
|
name (unicode): The mame of the architecture.
|
||||||
|
RETURNS (Model): The architecture.
|
||||||
|
"""
|
||||||
# Check if an entry point is exposed for the architecture code
|
# Check if an entry point is exposed for the architecture code
|
||||||
entry_point = get_entry_point(ENTRY_POINTS.architectures, name)
|
entry_point = get_entry_point(ENTRY_POINTS.architectures, name)
|
||||||
if entry_point is not None:
|
if entry_point is not None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user