INNER CODE UNIT · Python
register_backend
vacancy/SceneGraphParser · sng_parser/parser.py:80
def register_backend(cls, backend):
"""
Register a class as the backend. The backend should implement a
method named `parse` having the following signature:
`parse(sentence, <other_keyward_arguments>)`.
To register your customized backend as the parser, use this class
method as a decorator on your class.
Example::
>>> @Parser.register_backend
>>> class CustomizedBackend(Backend):
>>> # Your implementation follows...
>>> pass
"""
try:
cls._backend_registry[backend.__identifier__] = backend
except Exception as e: