Esempio n. 1
0
def main():
    if 'WEIGHTED_SETS' not in dir(mg) and 'UNWEIGHTED_SETS' not in dir(mg):
        print(
            'Define WEIGHTED_SETS and UNWEIGHTED_SETS in manager.py before using this module'
        )
        return
    TXT_DIR = mg.dir(os.path.join(mg.WORKING_PATH, 'txts'))
    PDF_DIR = mg.dir(os.path.join(mg.INPUT_PATH, 'pdfs'))
    data = mg.get_data()
    convertToText.walkAndText(PDF_DIR, TXT_DIR)
    find_paragraphs(TXT_DIR,
                    mg.WEIGHTED_SETS + mg.UNWEIGHTED_SETS,
                    outfile=os.path.join(mg.WORKING_PATH, 'paragraphs'))
    sets = assoc_sets(data,
                      TXT_DIR,
                      mg.WEIGHTED_SETS,
                      less_weighted_sets=mg.UNWEIGHTED_SETS)
    data['Sets'] = sets.values()
    mg.update_data()
Esempio n. 2
0
import manager as mg, json, os
data = mg.get_data()
data = data[data['Data Use'] == 'Y'].dropna(subset=['Authors'])
from biblio_reader import scholar_reader

types = {
    auth: 'Contributor' in val
    for auth, val in scholar_reader.authors(data, 'Contributor').items()
}
contributors = {
    author
    for i, authors in zip(data['i'], data['Authors'])
    for author in authors.split(' & ') if i in mg.CONTR_PAPERS
}

with open(
        os.path.join(mg.dir(os.path.join('data', 'author-links')),
                     'objects.json'), 'w') as o:
    json.dump([{
        'name':
        auth,
        'type':
        "Contributor" if types[auth] is True else 'Not a Contributor',
        'depends':
        list({aff
              for aff in affils if aff != auth and aff != 'others'})
    } for auth, affils in scholar_reader.authors(
        data, 'Authors', split=' & ').items() if auth != 'others'],
              o,
              sort_keys=True,
              indent=4)
Esempio n. 3
0
File: main.py Progetto: paulinia/SOC
import manager
import simulation
import matplotlib.pyplot as plt

data = [
    manager.get_data(x, x, simulation.Downside) for x in range(500, 501, 1)
]
print("\t\t\t".join([str(i) for i in range(500, 501, 1)]))
transform = [[
    str(dat[i][0]) + "\t" + str(dat[i][1]) + "\t" + str(dat[i][2])
    for dat in data
] for i in range(len(data[0]))]
print("\n".join(["\t".join(T) for T in transform]))