Example #1
0
def run(args):
    dicts = list(dsv.reader(get_conceptlist(args, path_only=True), delimiter="\t", dicts=True))
    out_dict = collections.OrderedDict()

    for d in dicts:
        out_dict[d[args.column]] = list(d.values())

    with dsv.UnicodeWriter(args.output, delimiter='\t') as w:
        w.writerow(dicts[0].keys())
        w.writerows(out_dict.values())
    if not args.output:
        print(w.read().decode('utf8'))
Example #2
0
def run(args):
    # Note: Due to https://github.com/concepticon/pyconcepticon/issues/10 we require specification
    # of an output file on Windows:
    if platform.system() == 'Windows' and not args.output:  # pragma: no cover
        raise ParserError(
            'On Windows you must specify an output file since printing to the terminal may '
            'not work')

    args.repos.map(
        get_conceptlist(args, path_only=True),
        otherlist=_get_conceptlist(args.reference_list, args, path_only=True)
        if args.reference_list else None,
        out=args.output,
        full_search=args.full_search,
        language=args.language,
        skip_multiple=args.skip_multimatch,
    )
Example #3
0
def run(args):
    for cl in get_conceptlist(args, path_only=True):
        print(termcolor.colored(cl, attrs=['bold', 'underline']))
        items = list(enumerate(read_dicts(cl), start=2))
        for check in CHECKS:
            print(
                termcolor.colored('Check: {0}'.format(check.__name__),
                                  attrs=['bold']))
            if args.verbose and check.__doc__:
                print(check.__doc__)
            try:
                check(items, args)
            except Exception as e:
                print(
                    termcolor.colored('{0}: {1}'.format(
                        e.__class__.__name__, e),
                                      color='red'))
        print()
Example #4
0
def run(args):
    format_set_operation(args.repos.intersection(*get_conceptlist(args)))
Example #5
0
def run(args):
    # @todo: check output
    cl = get_conceptlist(args)
    mapped, mapped_ratio, mergers = cl.stats()
    for k, v in mergers:
        print(k, v)
Example #6
0
def run(args):
    cl = get_conceptlist(args, path_only=True)
    rewrite(cl, Linker(cl.stem, args.repos.conceptsets.values()))