示例#1
0
def find_mojibake(program=None, check_abstract=False):
    if program is None:
        program = printprogram.get_program()
    bake = '&#65533'
    baked = []
    for p in program.submissions.values():
        ghost = False
        if bake in p.title:
            print p.id, "TITLE ", p.title
            ghost = True
        bauthors = [ba for ba in p.authors if bake in ba.fullName()]
        if len(bauthors) > 0:
            print p.id, "AUTHOR ", [b.fullName() for b in bauthors]
            ghost = True

        baffils = reduce(lambda x, y: x + y,
                         [[ba for ba in a.affiliations if bake in ba.name]
                          for a in p.authors], [])
        if len(baffils) > 0:
            print p.id, "AUTHOR AFFIL ", [b.name for b in baffils]
            ghost = True

        if (p.cAndB and bake in p.cAndB):
            print p.id, "C AND B ", p.cAndB
            ghost = True

        if (check_abstract and p.abstract and bake in p.abstract):
            print p.id, " ABSTRACAT ", p.abstract
            ghost = True

        if ghost: baked.append(p)

    return baked
示例#2
0
def find_mojibake(program=None, check_abstract=False):
    if program is None:
        program = printprogram.get_program()
    bake = '&#65533'
    baked = []
    for p in program.submissions.values():
        ghost = False
        if bake in p.title:
            print p.id, "TITLE ", p.title
            ghost = True
        bauthors = [ba for ba in p.authors if bake in ba.fullName()]
        if len(bauthors) > 0:
            print p.id, "AUTHOR ", [b.fullName() for b in bauthors]
            ghost = True

        baffils = reduce(lambda x,y: x+y, [[ba for ba in a.affiliations if bake in ba.name] for a in p.authors], [])
        if len(baffils) > 0:
            print p.id, "AUTHOR AFFIL ", [b.name for b in baffils]
            ghost = True

        if (p.cAndB and bake in p.cAndB): 
            print p.id, "C AND B ", p.cAndB
            ghost = True

        if (check_abstract and p.abstract and bake in p.abstract):
            print p.id, " ABSTRACAT ", p.abstract
            ghost = True            
            
        if ghost: baked.append(p)

    return baked
def fix_file(fname,ln_col,fn_col,email_col,affil_col,country_col,proceedings=None):
    if proceedings == None: proceedings = pp.get_program()
    authors_dict = build_dict(proceedings.authors.values())
    print "reading %s ", fname
    rin = csv.reader(open(fname,'rU'))
    fout = open("%s-out.csv"% fname,'w')
    wout = csv.writer(fout)
    rows = [wout.writerow(
            map(lambda x : cP.unescape(x), process(row,authors_dict,ln_col,fn_col,email_col,affil_col,country_col))
            ) for row in rin if len(row) > 0]
    fout.close()
def unpack(f="reviewers/authors_packed.csv"):
    authors = pp.get_program().authors.values()
    inf = csv.reader(codecs.open(f, "r", "utf-8"))
    outf = codecs.open("%s-out.csv" % f, "w", "utf-8")
    for author_row in inf:
        z = find_author(author_row[0], authors)
        if z:
            outf.write("%s\n" % ",".join([z.lastName, z.firstName, author_row[1]]))
        else:
            asplits = author_row[0].split(" ")
            outf.write(
                "%s\n" % ",".join([" ".join(asplits[1:]), asplits[0], author_row[1], "X" if len(asplits) > 2 else " "])
            )
    outf.close()
def unpack(f="reviewers/authors_packed.csv"):
    authors = pp.get_program().authors.values()
    inf = csv.reader(codecs.open(f, 'r', 'utf-8'))
    outf = codecs.open("%s-out.csv" % f, 'w', 'utf-8')
    for author_row in inf:
        z = find_author(author_row[0], authors)
        if z:
            outf.write("%s\n" %
                       ','.join([z.lastName, z.firstName, author_row[1]]))
        else:
            asplits = author_row[0].split(' ')
            outf.write("%s\n" % ','.join([
                ' '.join(asplits[1:]), asplits[0], author_row[1],
                'X' if len(asplits) > 2 else ' '
            ]))
    outf.close()
def fix_file(fname,
             ln_col,
             fn_col,
             email_col,
             affil_col,
             country_col,
             proceedings=None):
    if proceedings == None: proceedings = pp.get_program()
    authors_dict = build_dict(proceedings.authors.values())
    print "reading %s ", fname
    rin = csv.reader(open(fname, 'rU'))
    fout = open("%s-out.csv" % fname, 'w')
    wout = csv.writer(fout)
    rows = [
        wout.writerow(
            map(
                lambda x: cP.unescape(x),
                process(row, authors_dict, ln_col, fn_col, email_col,
                        affil_col, country_col))) for row in rin
        if len(row) > 0
    ]
    fout.close()