def create_new_synonym_list(): """ This just makes a SynList and populates it, first with ecoinvent, then with ILCD, and saves it to disk :return: """ synonyms = Flowables() # first, ecoinvent exchs = get_ecospold_exchanges() for exch in exchs: name, syns = synonyms_from_ecospold_exchange(exch) _add_set(synonyms, name, syns, exch.get('id')) # next, ILCD - but hold off for now for flow in ilcd_flow_generator(): name, syns, uid = synonyms_from_ilcd_flow(flow) _add_set(synonyms, name, syns, uid) with open(SYNONYMS, 'w') as fp: json.dump(synonyms.serialize(), fp) print('Wrote synonym file to %s' % SYNONYMS) return synonyms
def load_synonyms(file=SYNONYMS): with open(file) as fp: return Flowables.from_json(json.load(fp))