AllenNLP

2018-07-09  本文已影响42人  ShuiLocked

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.
上一篇下一篇

猜你喜欢

热点阅读