コード例 #1
0
def generate_label_count_subparser(subparsers):
    parser = subparsers.add_parser(
        "label-count",
        description=constants.TACL_HELPER_LABEL_COUNT_DESCRIPTION,
        help=constants.TACL_HELPER_LABEL_COUNT_HELP,
    )
    parser.set_defaults(func=label_count)
    utils.add_common_arguments(parser)
    utils.add_tokenizer_argument(parser)
    parser.add_argument("results", help=constants.TACL_HELPER_RESULTS_HELP, metavar="RESULTS")
コード例 #2
0
def generate_collapse_witness_results_subparser(subparsers):
    parser = subparsers.add_parser(
        "collapse-witnesses",
        description=constants.TACL_HELPER_COLLAPSE_DESCRIPTION,
        help=constants.TACL_HELPER_COLLAPSE_HELP,
    )
    parser.set_defaults(func=collapse_witnesses)
    utils.add_common_arguments(parser)
    utils.add_tokenizer_argument(parser)
    parser.add_argument("results", help=constants.TACL_HELPER_RESULTS_HELP, metavar="RESULTS")
コード例 #3
0
def generate_supplied_diff_subparser(subparsers):
    """Adds a sub-command parser to `subparsers` to run a diff query using
    the supplied results sets."""
    parser = subparsers.add_parser(
        'sdiff',
        description=constants.SUPPLIED_DIFF_DESCRIPTION,
        epilog=constants.SUPPLIED_DIFF_EPILOG,
        formatter_class=ParagraphFormatter,
        help=constants.SUPPLIED_DIFF_HELP)
    parser.set_defaults(func=supplied_diff)
    utils.add_common_arguments(parser)
    utils.add_tokenizer_argument(parser)
    utils.add_db_arguments(parser, True)
    utils.add_supplied_query_arguments(parser)
コード例 #4
0
def generate_supplied_diff_subparser(subparsers):
    """Adds a sub-command parser to `subparsers` to run a diff query using
    the supplied results sets."""
    parser = subparsers.add_parser(
        "sdiff",
        description=constants.SUPPLIED_DIFF_DESCRIPTION,
        epilog=constants.SUPPLIED_DIFF_EPILOG,
        formatter_class=ParagraphFormatter,
        help=constants.SUPPLIED_DIFF_HELP,
    )
    parser.set_defaults(func=supplied_diff)
    utils.add_common_arguments(parser)
    utils.add_tokenizer_argument(parser)
    utils.add_db_arguments(parser, True)
    utils.add_supplied_query_arguments(parser)
コード例 #5
0
def generate_results_subparser(subparsers):
    """Adds a sub-command parser to `subparsers` to manipulate CSV
    results data."""
    parser = subparsers.add_parser('results',
                                   description=constants.RESULTS_DESCRIPTION,
                                   epilog=constants.RESULTS_EPILOG,
                                   formatter_class=ParagraphFormatter,
                                   help=constants.RESULTS_HELP)
    utils.add_common_arguments(parser)
    parser.set_defaults(func=results)
    be_group = parser.add_argument_group('bifurcated extend')
    be_group.add_argument('-b',
                          '--bifurcated-extend',
                          dest='bifurcated_extend',
                          metavar='CORPUS',
                          help=constants.RESULTS_BIFURCATED_EXTEND_HELP)
    be_group.add_argument('--max-be-count',
                          dest='bifurcated_extend_size',
                          help=constants.RESULTS_BIFURCATED_EXTEND_MAX_HELP,
                          metavar='COUNT',
                          type=int)
    parser.add_argument('-e',
                        '--extend',
                        dest='extend',
                        help=constants.RESULTS_EXTEND_HELP,
                        metavar='CORPUS')
    parser.add_argument('--excise',
                        help=constants.RESULTS_EXCISE_HELP,
                        metavar='NGRAM',
                        type=str)
    parser.add_argument('--min-count',
                        dest='min_count',
                        help=constants.RESULTS_MINIMUM_COUNT_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--max-count',
                        dest='max_count',
                        help=constants.RESULTS_MAXIMUM_COUNT_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--min-count-work',
                        dest='min_count_work',
                        help=constants.RESULTS_MINIMUM_COUNT_WORK_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--max-count-work',
                        dest='max_count_work',
                        help=constants.RESULTS_MAXIMUM_COUNT_WORK_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--min-size',
                        dest='min_size',
                        help=constants.RESULTS_MINIMUM_SIZE_HELP,
                        metavar='SIZE',
                        type=int)
    parser.add_argument('--max-size',
                        dest='max_size',
                        help=constants.RESULTS_MAXIMUM_SIZE_HELP,
                        metavar='SIZE',
                        type=int)
    parser.add_argument('--min-works',
                        dest='min_works',
                        help=constants.RESULTS_MINIMUM_WORK_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--max-works',
                        dest='max_works',
                        help=constants.RESULTS_MAXIMUM_WORK_HELP,
                        metavar='COUNT',
                        type=int)
    parser.add_argument('--ngrams',
                        dest='ngrams',
                        help=constants.RESULTS_NGRAMS_HELP,
                        metavar='NGRAMS')
    parser.add_argument('--reciprocal',
                        action='store_true',
                        help=constants.RESULTS_RECIPROCAL_HELP)
    parser.add_argument('--reduce',
                        action='store_true',
                        help=constants.RESULTS_REDUCE_HELP)
    parser.add_argument('--remove',
                        help=constants.RESULTS_REMOVE_HELP,
                        metavar='LABEL',
                        type=str)
    parser.add_argument('--sort',
                        action='store_true',
                        help=constants.RESULTS_SORT_HELP)
    utils.add_tokenizer_argument(parser)
    parser.add_argument('-z',
                        '--zero-fill',
                        dest='zero_fill',
                        help=constants.RESULTS_ZERO_FILL_HELP,
                        metavar='CORPUS')
    parser.add_argument('results',
                        help=constants.RESULTS_RESULTS_HELP,
                        metavar='RESULTS')
    unsafe_group = parser.add_argument_group(
        constants.RESULTS_UNSAFE_GROUP_TITLE,
        constants.RESULTS_UNSAFE_GROUP_DESCRIPTION)
    unsafe_group.add_argument('--add-label-count',
                              action='store_true',
                              help=constants.RESULTS_ADD_LABEL_COUNT_HELP)
    unsafe_group.add_argument('--add-label-work-count',
                              action='store_true',
                              help=constants.RESULTS_ADD_LABEL_WORK_COUNT_HELP)
    unsafe_group.add_argument('--collapse-witnesses',
                              action='store_true',
                              help=constants.RESULTS_COLLAPSE_WITNESSES_HELP)
    unsafe_group.add_argument('--group-by-ngram',
                              dest='group_by_ngram',
                              help=constants.RESULTS_GROUP_BY_NGRAM_HELP,
                              metavar='CATALOGUE')
    unsafe_group.add_argument('--group-by-witness',
                              action='store_true',
                              help=constants.RESULTS_GROUP_BY_WITNESS_HELP)
コード例 #6
0
def generate_results_subparser(subparsers):
    """Adds a sub-command parser to `subparsers` to manipulate CSV
    results data."""
    parser = subparsers.add_parser(
        "results",
        description=constants.RESULTS_DESCRIPTION,
        epilog=constants.RESULTS_EPILOG,
        formatter_class=ParagraphFormatter,
        help=constants.RESULTS_HELP,
    )
    utils.add_common_arguments(parser)
    parser.set_defaults(func=results)
    be_group = parser.add_argument_group("bifurcated extend")
    be_group.add_argument(
        "-b",
        "--bifurcated-extend",
        dest="bifurcated_extend",
        metavar="CORPUS",
        help=constants.RESULTS_BIFURCATED_EXTEND_HELP,
    )
    be_group.add_argument(
        "--max-be-count",
        dest="bifurcated_extend_size",
        help=constants.RESULTS_BIFURCATED_EXTEND_MAX_HELP,
        metavar="COUNT",
        type=int,
    )
    parser.add_argument(
        "-c", "--catalogue", dest="catalogue", help=constants.RESULTS_CATALOGUE_HELP, metavar="CATALOGUE"
    )
    parser.add_argument("-e", "--extend", dest="extend", help=constants.RESULTS_EXTEND_HELP, metavar="CORPUS")
    parser.add_argument(
        "--min-count", dest="min_count", help=constants.RESULTS_MINIMUM_COUNT_HELP, metavar="COUNT", type=int
    )
    parser.add_argument(
        "--max-count", dest="max_count", help=constants.RESULTS_MAXIMUM_COUNT_HELP, metavar="COUNT", type=int
    )
    parser.add_argument(
        "--min-count-work",
        dest="min_count_work",
        help=constants.RESULTS_MINIMUM_COUNT_WORK_HELP,
        metavar="COUNT",
        type=int,
    )
    parser.add_argument(
        "--max-count-work",
        dest="max_count_work",
        help=constants.RESULTS_MAXIMUM_COUNT_WORK_HELP,
        metavar="COUNT",
        type=int,
    )
    parser.add_argument(
        "--min-size", dest="min_size", help=constants.RESULTS_MINIMUM_SIZE_HELP, metavar="SIZE", type=int
    )
    parser.add_argument(
        "--max-size", dest="max_size", help=constants.RESULTS_MAXIMUM_SIZE_HELP, metavar="SIZE", type=int
    )
    parser.add_argument(
        "--min-works", dest="min_works", help=constants.RESULTS_MINIMUM_WORK_HELP, metavar="COUNT", type=int
    )
    parser.add_argument(
        "--max-works", dest="max_works", help=constants.RESULTS_MAXIMUM_WORK_HELP, metavar="COUNT", type=int
    )
    parser.add_argument("--ngrams", dest="ngrams", help=constants.RESULTS_NGRAMS_HELP, metavar="NGRAMS")
    parser.add_argument("--reciprocal", action="store_true", help=constants.RESULTS_RECIPROCAL_HELP)
    parser.add_argument("--reduce", action="store_true", help=constants.RESULTS_REDUCE_HELP)
    parser.add_argument("--remove", help=constants.RESULTS_REMOVE_HELP, metavar="LABEL", type=str)
    parser.add_argument("--sort", action="store_true", help=constants.RESULTS_SORT_HELP)
    utils.add_tokenizer_argument(parser)
    parser.add_argument("-z", "--zero-fill", dest="zero_fill", help=constants.RESULTS_ZERO_FILL_HELP, metavar="CORPUS")
    parser.add_argument("results", help=constants.RESULTS_RESULTS_HELP, metavar="RESULTS")