Beispiel #1
0
def do_adhoc(text, g, trace=False, geo=False):
    ads = []
    if args['--geo']:
        ads = parse_with_geo(text, g, trace)
    else:
        ads = parse(text, trace)

    for ad in ads:
        print ad
Beispiel #2
0
def do_file_bulk(fn, g, trace=False, geo=False):
    ads = []
    line = codecs.open(fn, encoding="utf-8").read()
    line = line.encode("ascii", "ignore").strip()

    if geo:
        ads = parse_with_geo(line, g, trace)
    else:
        ads = parse(line, trace)

    print "Summary: %03d discovered" % len(ads)
    for i, ad in zip(range(1, len(ads) + 1), ads):
        print "%03d:\t%s" % (i, ad)
Beispiel #3
0
def do_file(fn, g, trace=False, geo=False):
    total, parsed, failed = 0, 0, 0
    ads = []
    for line in codecs.open(fn, encoding="utf-8"):
        line = line.encode("ascii", "ignore").strip()
        if line == "":
            continue

        total += 1

        if geo:
            ads = parse_with_geo(line, g, trace)
        else:
            ads = parse(line, trace)

        if ads:
            parsed += 1
            print "ok: [%s]" % line
        else:
            failed += 1

    print "Summary:\n\t%04d parsed\n\t%04d failed\n\t%04d Total" % (parsed, failed, total)
Beispiel #4
0
def do_file(fn, g, trace=False, geo=False):
    total, parsed, failed = 0, 0, 0
    ads = []
    for line in codecs.open(fn, encoding='utf-8'):
        line = line.encode('ascii', 'ignore').strip()
        if line == '':
            continue

        total += 1

        if geo:
            ads = parse_with_geo(line, g, trace)
        else:
            ads = parse(line, trace)

        if ads:
            parsed += 1
            print 'ok: [%s]' % line
        else:
            failed += 1

    print 'Summary:\n\t%04d parsed\n\t%04d failed\n\t%04d Total' \
        % (parsed, failed, total)