예제 #1
0
def bib(paper, source_str='[TACL]'):
    str = '@INPROCEEDINGS{%s,\n' % (paper['id'])
    str += '  AUTHOR = {%s},\n' % (paper['authors'])
    str += '  TITLE = {%s %s},\n' % (source_str,
                                     latex_escape(paper['title_str']))
    str += '  SORTNAME = {%s}}\n\n' % (paper['title_str'])
    return str
예제 #2
0
    pass

try:
    os.makedirs("auto/abstracts")
except:
    pass

paper_ids = [
    int(n) for n in filter(lambda x: re.match(r'^\d+$', x), os.listdir(fdir))
]
print paper_ids
BIBFILE = codecs.open("auto/" + tag + "/papers.bib", 'w', encoding='utf-8')
for n in paper_ids:
    n = int(n)
    p = Paper("%s/%d/%d_metadata.txt" % (fdir, n, n))
    author = " and ".join(["%s, %s" % (a.last, a.first) for a in p.authors])
    sortname = ''.join([
        c for c in unicodedata.normalize('NFD', unicode(author))
        if unicodedata.category(c) != 'Mn'
    ])

    #    print "%s %s -> %s" % (p.id, p.long, escape(p.long))
    print >> BIBFILE, "@INPROCEEDINGS{%s-%03d," % (tag, int(p.id))
    print >> BIBFILE, "   AUTHOR = {%s}," % author
    print >> BIBFILE, "   SORTNAME = {%s}," % sortname
    print >> BIBFILE, "   TITLE = {%s}}" % latex_escape(p.long)
    ABS = codecs.open("auto/abstracts/%s-%03d.tex" % (tag, n),
                      'w',
                      encoding='utf-8')
    print >> ABS, latex_escape(p.abstract)
fdir = sys.argv[1] # i.e., $ACLPUB_ROOT/final
tag  = sys.argv[2] # e.g., main, demos, ws1, ...

try:
    os.makedirs("auto/%s" % (tag))
except:
    pass

try:
    os.makedirs("auto/abstracts")
except:
    pass

paper_ids = [int(n) for n in filter(lambda x: re.match(r'^\d+$', x), os.listdir(fdir))]
BIBFILE   = codecs.open("auto/"+tag+"/papers.bib",'w', encoding='utf-8')
for n in paper_ids:
    n = int(n)
    p = Paper("%s/%d/%d_metadata.txt" % (fdir, n, n))
    author = " and ".join(["%s, %s" % (a.last, a.first) for a in p.authors])
    sortname = ''.join([c for c in unicodedata.normalize('NFD', unicode(author))
                        if unicodedata.category(c) != 'Mn'])

#    print "%s %s -> %s" % (p.id, p.long, escape(p.long))
    print >>BIBFILE, "@INPROCEEDINGS{%s-%03d," % (tag, int(p.id))
    print >>BIBFILE, "   AUTHOR = {%s}," % author
    print >>BIBFILE, "   SORTNAME = {%s}," % sortname
    print >>BIBFILE, "   TITLE = {%s}}" % latex_escape(p.long)
    ABS = codecs.open("auto/abstracts/%s-%03d.tex" % (tag, n),'w', encoding='utf-8')
    print >>ABS, latex_escape(p.abstract)
    
예제 #4
0
def bib(paper):
    str = '@INPROCEEDINGS{%s,\n' % (paper['id'])
    str += '  AUTHOR = {%s},\n' % (paper['authors'])
    str += '  TITLE = {%s},\n' % (latex_escape(paper['title']))
    str += '  SORTNAME = {%s}}\n\n' % (paper['title'])
    return str
예제 #5
0
for path in ['auto/tacl', 'auto/abstracts']:
    if not os.path.exists(path):
        os.makedirs(path)


def bib(paper):
    str = '@INPROCEEDINGS{%s,\n' % (paper['id'])
    str += '  AUTHOR = {%s},\n' % (paper['authors'])
    str += '  TITLE = {%s},\n' % (latex_escape(paper['title']))
    str += '  SORTNAME = {%s}}\n\n' % (paper['title'])
    return str


print >> sys.stderr, "Reading from file", args.yaml
print >> sys.stderr, "Write bibtex entries to auto/tacl/papers.bib"

bibfile = codecs.open('auto/tacl/papers.bib', 'w', encoding='utf-8')
for paper in yaml.load(open(args.yaml)):
    bibfile.write(bib(paper))

    print >> sys.stderr, "Writing abstract auto/abstracts/%s.tex" % (
        paper['id'])
    abstract = codecs.open('auto/abstracts/TACL-%s.tex' % (paper['id']),
                           'w',
                           encoding='utf-8')
    abstract.write(latex_escape(paper['abstract']))
    abstract.close()

bibfile.close()
예제 #6
0
def bib(paper):
    str  = '@INPROCEEDINGS{%s,\n' % (paper['id'])
    str += '  AUTHOR = {%s},\n' % (paper['authors'])
    str += '  TITLE = {%s},\n' % (latex_escape(paper['title']))
    str += '  SORTNAME = {%s}}\n\n' % (paper['title'])
    return str
예제 #7
0
import yaml

PARSER = argparse.ArgumentParser(description="Generate schedules for *ACL handbooks")
PARSER.add_argument("-yaml", default='input/tacl_papers.yaml', type=str, help="File path for TACL YAML file")
args = PARSER.parse_args()

for path in ['auto/tacl', 'auto/abstracts']:
    if not os.path.exists(path):
        os.makedirs(path)

def bib(paper):
    str  = '@INPROCEEDINGS{%s,\n' % (paper['id'])
    str += '  AUTHOR = {%s},\n' % (paper['authors'])
    str += '  TITLE = {%s},\n' % (latex_escape(paper['title']))
    str += '  SORTNAME = {%s}}\n\n' % (paper['title'])
    return str

#print >> sys.stderr, "Reading from file", args.yaml
#print >> sys.stderr, "Write bibtex entries to auto/tacl/papers.bib"

bibfile = codecs.open('auto/tacl/papers.bib', 'w', encoding = 'utf-8')
for paper in yaml.load(open(args.yaml)):
    bibfile.write(bib(paper))

    #print >> sys.stderr, "Writing abstract auto/abstracts/%s.tex" % (paper['id'])
    abstract = codecs.open('auto/abstracts/%s.tex' % (paper['id']), 'w', encoding='utf-8')
    abstract.write(latex_escape(paper['abstract']))
    abstract.close()

bibfile.close()