api/dblpv7.py
def write_records_to_csv(records, ppath='papers.csv', rpath='refs.csv'):
    """Write the records to csv files.
    :param str ppath: Path of file to write paper records to.
    :param str rpath: Path of file to write paper references to.
    """
    pf = open(ppath, 'w')
    rf = open(rpath, 'w')
    paper_writer = UnicodeWriter(pf)  # handle titles/abstracts
    refs_writer = csv.writer(rf)

    # write csv column headers
    paper_writer.writerow(Record.csv_header)
    refs_writer.writerow(('paper_id', 'ref_id'))

    # accumulate list of unique years and venues
    venues = set()
    years = set()

    for record in records:
        venues.add(record.venue)
        years.add(record.year)
        paper_writer.writerow(record.csv_attrs)
        for ref in record.refs:
            refs_writer.writerow((record.id, ref))

    with open('venues.csv', 'w') as f:
        f.write('\n'.join(venues).encode('utf-8'))

    with open('years.csv', 'w') as f:
        f.write(u'\n'.join(map(str, years)))
Write the records to csv files.
    :param str ppath: Path of file to write paper records to.
    :param str rpath: Path of file to write paper references to.
    
Write the records to csv files.
Write the records to csv files .
def write_records_to_csv(records, ppath='papers.csv', rpath='refs.csv'):
    pf = open(ppath, 'w')
    rf = open(rpath, 'w')
    paper_writer = UnicodeWriter(pf)  
    refs_writer = csv.writer(rf)
    paper_writer.writerow(Record.csv_header)
    refs_writer.writerow(('paper_id', 'ref_id'))
    venues = set()
    years = set()
    for record in records:
        venues.add(record.venue)
        years.add(record.year)
        paper_writer.writerow(record.csv_attrs)
        for ref in record.refs:
            refs_writer.writerow((record.id, ref))
    with open('venues.csv', 'w') as f:
        f.write('\n'.join(venues).encode('utf-8'))
    with open('years.csv', 'w') as f:
        f.write(u'\n'.join(map(str, years)))
def write_records_to_csv ( records , ppath = 'papers.csv' , rpath = 'refs.csv' ) : pf = open ( ppath , 'w' ) rf = open ( rpath , 'w' ) paper_writer = UnicodeWriter ( pf ) refs_writer = csv . writer ( rf ) paper_writer . writerow ( Record . csv_header ) refs_writer . writerow ( ( 'paper_id' , 'ref_id' ) ) venues = set ( ) years = set ( ) for record in records : venues . add ( record . venue ) years . add ( record . year ) paper_writer . writerow ( record . csv_attrs ) for ref in record . refs : refs_writer . writerow ( ( record . id , ref ) ) with open ( 'venues.csv' , 'w' ) as f : f . write ( '\n' . join ( venues ) . encode ( 'utf-8' ) ) with open ( 'years.csv' , 'w' ) as f : f . write ( u'\n' . join ( map ( str , years ) ) )
Write the records to csv files.
Write the records to csv files .
"""Write the records to csv files.
    :param str ppath: Path of file to write paper records to.
    :param str rpath: Path of file to write paper references to.
    """ # handle titles/abstracts # write csv column headers # accumulate list of unique years and venues
records
ppath
Path of file to write paper records to.
Path of file to write paper records to .
rpath
Path of file to write paper references to.
Path of file to write paper references to .