AllenNLP

How `subcommand' works?

In subcommand.py:

if 'func' in dir(args):
        # Import any additional modules needed (to register custom classes).
        for package_name in getattr(args, 'include_package', ()):
            import_submodules(package_name)
        args.func(args)
    else:
        parser.print_help()

while in predict.py:

subparser.set_defaults(func=_predict)

Finally, it calls the function _predict() in predict.py, if we type in the command :

allennlp predict.

你可能感兴趣的:(AllenNLP)