diff --git a/spacy/errors.py b/spacy/errors.py index de93eaf2e..5d4d4298e 100644 --- a/spacy/errors.py +++ b/spacy/errors.py @@ -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 diff --git a/spacy/util.py b/spacy/util.py index d56f39a78..9798ff11b 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -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: