In [1]:
# JSON taken from https://github.com/smargh/Classical-Studies-Resources
# Also parses LIST2GEO.BIN, LIST2FEM.BIN, etc., through LIST4GEO.BIN
import json
import os
from pprint import pprint
In [2]:
tlg_json = {'author_date': 'tlg_authors_by_date.json',
'author_epithet': 'tlg_authors_by_epithet.json',
'author_geo': 'tlg_authors_by_geography.json',
'author_female': 'tlg_authors_by_sex.json'
}
In [3]:
for file, path in tlg_json.items():
_dir = os.path.expanduser('~/Classical-Studies-Resources/')
full_path = os.path.join(_dir, path)
with open(full_path) as file_open:
tlg_data = json.load(file_open)
write_dir = os.path.expanduser('~/cltk/cltk/corpus/greek/tlg')
write_path = os.path.join(write_dir, file + '.json')
with open(write_path, 'w') as file_open:
json.dump(tlg_data, file_open, sort_keys=True, indent=4, separators=(',', ': '))