Exemple #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)
Exemple #2
0
def _add_split_args(parser: argparse.ArgumentParser) -> None:
    add_nlu_data_param(parser)
    parser.add_argument("--training_fraction",
                        type=float,
                        default=0.8,
                        help="Percentage of the data which should be the "
                        "training data")
    parser.add_argument("-o",
                        "--out",
                        type=str,
                        default="train_test_split",
                        help="Directory where the split files should be "
                        "stored")