Update formatting and docstrings [ci skip]

This commit is contained in:
Ines Montani 2019-10-08 12:25:23 +02:00
parent ddd6fda59c
commit c4f95c1569
2 changed files with 13 additions and 2 deletions

View File

@ -496,7 +496,8 @@ class Errors(object):
E173 = ("As of v2.2, the Lemmatizer is initialized with an instance of "
"Lookups containing the lemmatization tables. See the docs for "
"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

View File

@ -124,6 +124,11 @@ def set_data_path(path):
def register_architecture(name, arch=None):
"""Decorator to register an architecture. An architecture is a function
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
if arch is not None:
@ -138,7 +143,12 @@ def register_architecture(name, arch=None):
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
entry_point = get_entry_point(ENTRY_POINTS.architectures, name)
if entry_point is not None: