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

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    # note: not the usual input args
    psr.add_argument('corpus', metavar='DIR', help='corpus dir')
    psr.add_argument('--output',
                     metavar='DIR',
                     required=True,
                     help='output  dir')
    psr.add_argument('--no-draw',
                     action='store_false',
                     dest='draw',
                     default=True,
                     help='Do not actually draw the graph')
    psr.add_argument('--strip-cdus',
                     action='store_true',
                     help='Strip away CDUs (substitute w heads)')

    educe_group = psr.add_argument_group('corpus filtering arguments')
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    psr.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.
    """
    # note: not the usual input args
    parser.add_argument('corpus', metavar='DIR', help='corpus dir')
    parser.add_argument('rel_types',
                        metavar='REL_LABEL',
                        nargs='+',
                        help='relation labels to keep')
    parser.add_argument('--output',
                        metavar='DIR',
                        required=True,
                        help='output  dir')
    parser.add_argument('--no-draw',
                        action='store_false',
                        dest='draw',
                        default=True,
                        help='Do not actually draw the graph')

    educe_group = parser.add_argument_group('corpus filtering arguments')
    # doesn't make sense to filter on stage for graphs
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    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.
    """
    # note: not the usual input args
    parser.add_argument('corpus', metavar='DIR', help='corpus dir')
    parser.add_argument('--output',
                        metavar='DIR',
                        required=True,
                        help='output  dir')
    parser.add_argument('--no-draw',
                        action='store_false',
                        dest='draw',
                        default=True,
                        help='Do not actually draw the graph')
    parser.add_argument('--highlight',
                        nargs='+',
                        metavar='ANNO_ID',
                        type=anno_id,
                        help='Highlight these annotations')
    parser.add_argument('--live',
                        action='store_true',
                        help='Input is a flat collection of aa/ac files)')

    # TODO: would be nice to enforce these groups of args mutually excluding
    # but not sure if the library actually supports it
    psr_rel = parser.add_argument_group("relation graphs")
    psr_rel.add_argument('--split',
                         action='store_true',
                         help='Separate file for each connected component')
    psr_rel.add_argument('--strip-cdus',
                         action='store_true',
                         help='Strip away CDUs')
    psr_rel.add_argument('--strip-mode',
                         choices=['head', 'broadcast', 'custom'],
                         default='head',
                         help='CDUs stripping method')

    psr_rfc = parser.add_argument_group("RFC graphs")
    psr_rfc.add_argument('--rfc',
                         choices=['basic', 'mlast'],
                         help='Highlight RFC frontier and violations')

    psr_enc = parser.add_argument_group("enclosure graphs")
    psr_enc.add_argument('--enclosure',
                         action='store_true',
                         help='Generate enclosure graphs')
    psr_enc.add_argument('--tokens',
                         action='store_true',
                         help='Include pos-tagged tokens')

    educe_group = parser.add_argument_group('corpus filtering arguments')
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    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.
    """
    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 #5
0
def config_argparser(parser):
    """
    Subcommand flags.
    """
    parser.add_argument('corpus', metavar='DIR',
                        help='Corpus dir (eg. data/pilot)')
    parser.add_argument('resources', metavar='DIR',
                        help='Resource dir (eg. data/resource)')
    parser.add_argument('--output', metavar='FILE',
                        help='Output file')
    # add flags --doc, --subdoc, etc to allow user to filter on these things
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    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('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 #7
0
def config_argparser(parser):
    """
    Subcommand flags.
    """
    parser.add_argument('corpus',
                        metavar='DIR',
                        help='Corpus dir (eg. data/pilot)')
    parser.add_argument('resources',
                        metavar='DIR',
                        help='Resource dir (eg. data/resource)')
    parser.add_argument('--output', metavar='FILE', help='Output file')
    # add flags --doc, --subdoc, etc to allow user to filter on these things
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    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.
    """
    # note: not the usual input args
    parser.add_argument('corpus', metavar='DIR', help='corpus dir')
    parser.add_argument('--output', metavar='DIR', required=True,
                        help='output  dir')
    parser.add_argument('--no-draw', action='store_false',
                        dest='draw',
                        default=True,
                        help='Do not actually draw the graph')
    parser.add_argument('--highlight', nargs='+',
                        metavar='ANNO_ID', type=anno_id,
                        help='Highlight these annotations')
    parser.add_argument('--live', action='store_true',
                        help='Input is a flat collection of aa/ac files)')

    # TODO: would be nice to enforce these groups of args mutually excluding
    # but not sure if the library actually supports it
    psr_rel = parser.add_argument_group("relation graphs")
    psr_rel.add_argument('--split', action='store_true',
                         help='Separate file for each connected component')
    psr_rel.add_argument('--strip-cdus', action='store_true',
                         help='Strip away CDUs')
    psr_rel.add_argument('--strip-mode',
                         choices=['head', 'broadcast', 'custom'],
                         default='head',
                         help='CDUs stripping method')

    psr_rfc = parser.add_argument_group("RFC graphs")
    psr_rfc.add_argument('--rfc', choices=['basic', 'mlast'],
                         help='Highlight RFC frontier and violations')

    psr_enc = parser.add_argument_group("enclosure graphs")
    psr_enc.add_argument('--enclosure', action='store_true',
                         help='Generate enclosure graphs')
    psr_enc.add_argument('--tokens', action='store_true',
                         help='Include pos-tagged tokens')

    educe_group = parser.add_argument_group('corpus filtering arguments')
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    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.
    """
    parser.add_argument('corpus', metavar='DIR',
                        nargs='?',
                        help='corpus dir')
    parser.add_argument('--strip-cdus', action='store_true',
                       help='remove CDUs from graphs')
    parser.add_argument('--mode', choices=['violations', 'power'],
        default='violations',
        help='count RFC violations or filtering power')
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    add_usual_output_args(parser)
    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.
    """
    parser.add_argument('corpus', metavar='DIR', nargs='?', help='corpus dir')
    parser.add_argument('--strip-cdus',
                        action='store_true',
                        help='remove CDUs from graphs')
    parser.add_argument('--mode',
                        choices=['violations', 'power'],
                        default='violations',
                        help='count RFC violations or filtering power')
    add_corpus_filters(parser, fields=fields_without(["stage"]))
    add_usual_output_args(parser)
    parser.set_defaults(func=main)
Example #11
0
def config_argparser(psr):
    """
    Subcommand flags.

    You should create and pass in the subparser to which the flags
    are to be added.
    """
    # note: not the usual input args
    psr.add_argument('corpus', metavar='DIR', help='corpus dir')
    psr.add_argument('--output', metavar='DIR', required=True,
                     help='output  dir')
    psr.add_argument('--no-draw', action='store_false',
                     dest='draw',
                     default=True,
                     help='Do not actually draw the graph')
    psr.add_argument('--strip-cdus', action='store_true',
                     help='Strip away CDUs (substitute w heads)')

    educe_group = psr.add_argument_group('corpus filtering arguments')
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    psr.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.
    """
    # note: not the usual input args
    parser.add_argument('corpus', metavar='DIR', help='corpus dir')
    parser.add_argument('rel_types', metavar='REL_LABEL', nargs='+',
                        help='relation labels to keep')
    parser.add_argument('--output', metavar='DIR', required=True,
                        help='output  dir')
    parser.add_argument('--no-draw', action='store_false',
                        dest='draw',
                        default=True,
                        help='Do not actually draw the graph')

    educe_group = parser.add_argument_group('corpus filtering arguments')
    # doesn't make sense to filter on stage for graphs
    add_corpus_filters(educe_group, fields=fields_without(["stage"]))
    parser.set_defaults(func=main)
Example #13
0
# apikey=... # see https://trello.com/1/appKey/generate#
# token=...  # generate the private token URL via
#            # http://pythonhosted.org/trello/examples.html
#            # then visit in your web browser to approve
#            # and paste in the resulting token

# ---------------------------------------------------------------------
# args
# ---------------------------------------------------------------------

arg_parser = argparse.ArgumentParser(description='Dump EDU text' )
arg_parser.add_argument('idir', metavar='DIR',
                        help='Input directory'
                        )
educe_group = arg_parser.add_argument_group('corpus filtering arguments')
util.add_corpus_filters(educe_group, fields=[ 'doc' ])
args=arg_parser.parse_args()
args.subdoc    = None
args.stage     = 'unannotated'
args.annotator = None
is_interesting=util.mk_is_interesting(args)

# ---------------------------------------------------------------------
# main
# ---------------------------------------------------------------------

reader = educe.stac.Reader(args.idir)
anno_files = reader.filter(reader.files(), is_interesting)

trello  = tr.TrelloApi(secrets.apikey, secrets.token)
board   = trello.boards.get(board_id)
Example #14
0
# secrets needs two values
# apikey=... # see https://trello.com/1/appKey/generate#
# token=...  # generate the private token URL via
#            # http://pythonhosted.org/trello/examples.html
#            # then visit in your web browser to approve
#            # and paste in the resulting token

# ---------------------------------------------------------------------
# args
# ---------------------------------------------------------------------

arg_parser = argparse.ArgumentParser(description='Dump EDU text')
arg_parser.add_argument('idir', metavar='DIR', help='Input directory')
educe_group = arg_parser.add_argument_group('corpus filtering arguments')
util.add_corpus_filters(educe_group, fields=['doc'])
args = arg_parser.parse_args()
args.subdoc = None
args.stage = 'unannotated'
args.annotator = None
is_interesting = util.mk_is_interesting(args)

# ---------------------------------------------------------------------
# main
# ---------------------------------------------------------------------

reader = educe.stac.Reader(args.idir)
anno_files = reader.filter(reader.files(), is_interesting)

trello = tr.TrelloApi(secrets.apikey, secrets.token)
board = trello.boards.get(board_id)