Example #1
0
def add_subparser(subparsers: argparse._SubParsersAction,
                  parents: List[argparse.ArgumentParser]):
    import rasa.core.cli.train as core_cli

    train_parser = subparsers.add_parser(
        "train", help="Train the Rasa bot")

    train_subparsers = train_parser.add_subparsers()
    train_core_parser = train_subparsers.add_parser(
        "core",
        conflict_handler="resolve",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        help="Train Rasa Core")
    train_core_parser.set_defaults(func=train_core)

    train_nlu_parser = train_subparsers.add_parser(
        "nlu",
        parents=parents,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        help="Train Rasa NLU")
    train_nlu_parser.set_defaults(func=train_nlu)

    for p in [train_parser, train_core_parser, train_nlu_parser]:
        add_general_arguments(p)

    for p in [train_core_parser, train_parser]:
        add_domain_param(p)
        core_cli.add_general_args(p)
    add_stories_param(train_core_parser)
    _add_core_compare_arguments(train_core_parser)

    add_nlu_data_param(train_nlu_parser)

    add_joint_parser_arguments(train_parser)
    train_parser.set_defaults(func=train)
Example #2
0
def add_subparser(subparsers: argparse._SubParsersAction,
                  parents: List[argparse.ArgumentParser]):
    interactive_parser = subparsers.add_parser(
        "interactive",
        conflict_handler="resolve",
        parents=parents,
        help="Teach the bot with interactive learning",
    )

    run.add_run_arguments(interactive_parser)
    train.add_general_arguments(interactive_parser)
    train.add_domain_param(interactive_parser)
    train.add_joint_parser_arguments(interactive_parser)
    _add_interactive_arguments(interactive_parser)

    interactive_parser.set_defaults(func=interactive)

    interactive_subparsers = interactive_parser.add_subparsers()
    interactive_core_parser = interactive_subparsers.add_parser(
        "core",
        conflict_handler="resolve",
        parents=parents,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        help="Train a Rasa Core model with interactive learning",
    )

    train.add_domain_param(interactive_core_parser)
    core_cli.add_general_args(interactive_core_parser)
    train.add_stories_param(interactive_core_parser)
    train.add_domain_param(interactive_core_parser)
    run.add_run_arguments(interactive_core_parser)
    _add_interactive_arguments(interactive_core_parser)
    train.add_general_arguments(interactive_core_parser)

    interactive_core_parser.set_defaults(func=interactive_core)