Example #1
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument('span',
                        metavar='INT,INT',
                        type=comma_span,
                        help='text span')
    parser.add_argument('nudge_start',
                        metavar='INT',
                        type=int,
                        help='adjust start [-1 to 1]')
    parser.add_argument('nudge_end',
                        metavar='INT',
                        type=int,
                        help='adjust end   [-1 to 1]')
    parser.add_argument('--allow-shove',
                        action='store_true',
                        help='allow adjustments larger than 1')
    parser.add_argument('--stage',
                        metavar='STAGE',
                        choices=['discourse', 'units', 'unannotated'])
    parser.add_argument('--annotator', metavar='STRING')
    parser.set_defaults(func=main)
Example #2
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    parser.add_argument('corpus', metavar='DIR', nargs='?', help='corpus dir')
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    add_usual_output_args(parser, default_overwrite=True)
    parser.set_defaults(func=main)
Example #3
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument("turn", metavar="TURN", type=int, help="turn number")
    parser.set_defaults(func=main)
Example #4
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument('turn', metavar='TURN', type=int, help='turn number')
    parser.set_defaults(func=main)
Example #5
0
File: weave.py Project: kowey/educe
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    parser.add_argument('augmented', metavar='DIR',
                        help='augmented corpus dir')
    add_usual_input_args(parser,
                         help_suffix='to insert into')
    add_usual_output_args(parser)
    parser.set_defaults(func=main)
Example #6
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    parser.add_argument('augmented',
                        metavar='DIR',
                        help='augmented corpus dir')
    add_usual_input_args(parser, help_suffix='to insert into')
    add_usual_output_args(parser)
    parser.set_defaults(func=main)
Example #7
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    parser.add_argument('corpus', metavar='DIR',
                        nargs='?',
                        help='corpus dir')
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    add_usual_output_args(parser, default_overwrite=True)
    parser.set_defaults(func=main)
Example #8
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to move from')
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('span', metavar='INT,INT', type=comma_span,
                        help='Text span')
    parser.add_argument('target', metavar='SUBDOC')
    parser.set_defaults(func=main)
Example #9
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to move from')
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('span', metavar='INT,INT', type=comma_span,
                        help='Text span')
    parser.add_argument('target', metavar='SUBDOC')
    parser.set_defaults(func=main)
Example #10
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument('turn', metavar='TURN', type=TurnId.from_string,
                        help='turn number')
    parser.add_argument('direction', choices=["up", "down"],
                        help='move turn up or down')
    parser.set_defaults(func=main)
Example #11
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument('turn', metavar='TURN', type=int,
                        help='turn number')
    parser.add_argument('direction', choices=["up", "down"],
                        help='move turn up or down')
    parser.set_defaults(func=main)
Example #12
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to insert into')
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('insert', metavar='DIR',
                        help='dir with just one pair of .aa/.ac files')
    parser.add_argument('start', metavar='INT', type=int,
                        help='insert before Nth char (negative indices ok)')
    parser.set_defaults(func=main)
Example #13
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('anno_id', type=anno_id, metavar='ANNO_ID',
                        help='id to rename (eg. kowey_398190)')
    parser.add_argument('--stage', metavar='STAGE',
                        choices=['discourse', 'units', 'unannotated'])
    parser.add_argument('--annotator', metavar='STRING')
    parser.set_defaults(func=main)
Example #14
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to insert into')
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('insert', metavar='DIR',
                        help='dir with just one pair of .aa/.ac files')
    parser.add_argument('start', metavar='INT', type=int,
                        help='insert before Nth char (negative indices ok)')
    parser.set_defaults(func=main)
Example #15
0
def config_argparser(parser):
    """Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to insert into')
    parser.add_argument('--span', metavar='SPAN', type=comma_span,
                        required=True,
                        help='span of the substitution site')
    parser.add_argument('--minor', action='store_true',
                        help='minor fix, leave annotations as they are')
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #16
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    # select generation
    parser.add_argument('--gen', metavar='N', type=int, default=2,
                        help='max generation of turns to include (1, 2, 3)')
    #
    parser.add_argument('augmented', metavar='DIR',
                        help='augmented corpus dir')
    add_usual_input_args(parser,
                         help_suffix='to insert into')
    add_usual_output_args(parser)
    parser.set_defaults(func=main)
Example #17
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    parser.add_argument('--annotator', metavar='PY_REGEX',
                        required=True,  # should limit annotator
                        help='annotator')
    parser.add_argument('--span', metavar='SPAN', type=comma_span,
                        required=True,
                        help='eg. 347,363')
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #18
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    parser.add_argument('--stage', metavar='STAGE',
                        choices=['discourse', 'units', 'unannotated'])
    parser.add_argument('--annotator', metavar='STRING')
    parser.add_argument('--source', type=anno_id, metavar='ANNO_ID',
                        required=True,
                        help='id to rename (eg. kowey_398190)')
    parser.add_argument('--target', type=anno_id, metavar='ANNO_ID',
                        help='id to rename to (default: autogenerated)')
    parser.set_defaults(func=main)
Example #19
0
def config_argparser(parser):
    """Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='to insert into')
    parser.add_argument('--span', metavar='SPAN', type=comma_span,
                        required=True,
                        help='span of the substitution site')
    parser.add_argument('--sub_text', metavar='TEXT',
                        required=True,
                        help='substitution text')
    parser.add_argument('--minor', action='store_true',
                        help='minor fix, leave annotations as they are')
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #20
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    parser.add_argument(
        '--annotator',
        metavar='PY_REGEX',
        required=True,  # should limit annotator
        help='annotator')
    parser.add_argument('--span',
                        metavar='SPAN',
                        type=comma_span,
                        required=True,
                        help='eg. 347,363')
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #21
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='in which to merge')
    add_usual_output_args(parser, default_overwrite=True)
    parser_mutex = parser.add_mutually_exclusive_group(required=True)
    parser_mutex.add_argument('--dialogues',
                              metavar='ANNO_ID', type=anno_id,
                              nargs='+',
                              help='eg. stac_39819045 stac_98871771')
    parser_mutex.add_argument('--turns',
                              metavar='TURN_ID', type=parse_turn_id,
                              nargs=2,
                              help='eg. 187 192')
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #22
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True,
                         help_suffix='in which to merge')
    add_usual_output_args(parser, default_overwrite=True)
    parser_mutex = parser.add_mutually_exclusive_group(required=True)
    parser_mutex.add_argument('--dialogues',
                              metavar='ANNO_ID', type=anno_id,
                              nargs='+',
                              help='eg. stac_39819045 stac_98871771')
    parser_mutex.add_argument('--turns',
                              metavar='INT', type=int,
                              nargs=2,
                              help='eg. 187 192')
    add_commit_args(parser)
    parser.set_defaults(func=main)
Example #23
0
def config_argparser(parser):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    add_usual_input_args(parser, doc_subdoc_required=True)
    add_usual_output_args(parser, default_overwrite=True)
    add_commit_args(parser)
    parser.add_argument('span', metavar='INT,INT', type=comma_span,
                        help='text span')
    parser.add_argument('nudge_start', metavar='INT', type=int,
                        help='adjust start [-1 to 1]')
    parser.add_argument('nudge_end', metavar='INT', type=int,
                        help='adjust end   [-1 to 1]')
    parser.add_argument('--allow-shove', action='store_true',
                        help='allow adjustments larger than 1')
    parser.add_argument('--stage', metavar='STAGE',
                        choices=['discourse', 'units', 'unannotated'])
    parser.add_argument('--annotator', metavar='STRING')
    parser.set_defaults(func=main)
Example #24
0
def mk_argparser():
    """
    Command line parser for this script
    """
    psr = argparse.ArgumentParser(description='.seg intermediary file writer')

    psr.add_argument('corpus', metavar='DIR', help='corpus dir')
    # shall we pull resources out of the data?
    psr.add_argument('--no-resources',
                     dest='resources',
                     action='store_false',
                     default=True,
                     help='suppress resource extraction')
    psr.add_argument('--resources',
                     action='store_true',
                     help='allow resource extraction (default)')
    psr.set_defaults(resources=True)
    # if we do grab resources, should we extract their
    # giveble/receivable status or leave it Unknown?
    psr.add_argument('--no-resource-status',
                     dest='resource_status',
                     action='store_false',
                     default=True,
                     help='suppress resource status labels')
    psr.add_argument('--resource-status',
                     action='store_true',
                     help='allow resource status labels (default)')
    psr.set_defaults(resource_status=True)

    # what about dialogue acts?
    # you could also just extract from unannotated, but skipping
    # dialogue acts lets you pull out other stuff that may be in
    # units like the addresees whilst ignoring the dialogue acts
    psr.add_argument('--no-dialogue-acts',
                     dest='dialogue_acts',
                     action='store_false',
                     default=True,
                     help='suppress resource extraction')
    psr.add_argument('--dialogue-acts',
                     action='store_true',
                     help='allow resource extraction (default)')
    psr.set_defaults(dialogue_acts=True)

    # dialogue boundaries
    psr.add_argument('--no-dialogue-boundaries',
                     dest='dialogue_boundaries',
                     action='store_false',
                     default=True,
                     help='suppress dialogue boundaries')
    psr.add_argument('--dialogue-boundaries',
                     action='store_true',
                     help='emit dialogue boundaries (called TURN here)')
    psr.set_defaults(dialogue_boundaries=True)

    psr.add_argument('--fake-turn-ids',
                     action='store_true',
                     help="ignore turn ids; just enumerate")

    psr.add_argument('--pipeline',
                     action='store_true',
                     help="default settings for pipeline use"
                     " (implies --no-dialogue-boundaries, etc)")
    # don't allow stage control; must be units or unannotated
    educe.util.add_corpus_filters(psr, fields=['doc', 'subdoc', 'annotator'])
    psr.add_argument('--stage',
                     choices=['units', 'unannotated'],
                     default='units',
                     help='which section of the corpus to read')
    add_usual_output_args(psr)
    return psr
Example #25
0
def mk_argparser():
    """
    Command line parser for this script
    """
    psr = argparse.ArgumentParser(description='.seg intermediary file writer')

    psr.add_argument('corpus', metavar='DIR', help='corpus dir')
    # shall we pull resources out of the data?
    psr.add_argument('--no-resources', dest='resources',
                     action='store_false',
                     default=True,
                     help='suppress resource extraction')
    psr.add_argument('--resources',
                     action='store_true',
                     help='allow resource extraction (default)')
    psr.set_defaults(resources=True)
    # if we do grab resources, should we extract their
    # giveble/receivable status or leave it Unknown?
    psr.add_argument('--no-resource-status', dest='resource_status',
                     action='store_false',
                     default=True,
                     help='suppress resource status labels')
    psr.add_argument('--resource-status',
                     action='store_true',
                     help='allow resource status labels (default)')
    psr.set_defaults(resource_status=True)

    # what about dialogue acts?
    # you could also just extract from unannotated, but skipping
    # dialogue acts lets you pull out other stuff that may be in
    # units like the addresees whilst ignoring the dialogue acts
    psr.add_argument('--no-dialogue-acts', dest='dialogue_acts',
                     action='store_false',
                     default=True,
                     help='suppress resource extraction')
    psr.add_argument('--dialogue-acts',
                     action='store_true',
                     help='allow resource extraction (default)')
    psr.set_defaults(dialogue_acts=True)

    # dialogue boundaries
    psr.add_argument('--no-dialogue-boundaries',
                     dest='dialogue_boundaries',
                     action='store_false',
                     default=True,
                     help='suppress dialogue boundaries')
    psr.add_argument('--dialogue-boundaries',
                     action='store_true',
                     help='emit dialogue boundaries (called TURN here)')
    psr.set_defaults(dialogue_boundaries=True)

    psr.add_argument('--fake-turn-ids',
                     action='store_true',
                     help="ignore turn ids; just enumerate")

    psr.add_argument('--pipeline',
                     action='store_true',
                     help="default settings for pipeline use"
                     " (implies --no-dialogue-boundaries, etc)")
    # don't allow stage control; must be units or unannotated
    educe.util.add_corpus_filters(psr,
                                  fields=['doc', 'subdoc', 'annotator'])
    psr.add_argument('--stage',
                     choices=['units', 'unannotated'],
                     default='units',
                     help='which section of the corpus to read')
    add_usual_output_args(psr)
    return psr