4 ms·
You can download these files: - resources: https://littlealchemy.com/resources/base.560.json https://littlealchemy.com/resources/base.560.json - names: https:
by alexcasalboni 9y ago
You can download these files:
- resources: https://littlealchemy.com/resources/base.560.json https://littlealchemy.com/resources/base.560.json
- names: https://littlealchemy.com/resources/en/names.560.json https://littlealchemy.com/resources/en/names.560.json
Then you can run this Python code to extract/merge into one single file:
import json
with open('res.json', 'r') as f, open('names.json', 'r') as ff:
res = json.load(f)
names = json.load(ff)
for res_id, res_name in names.iteritems():
print("%s:" % res_name)
for id1, id2 in res[str(res_id)].get('parents', []):
print("\t %s + %s" % (names[str(id1)], names[str(id2)]))
Expected output:
glacier:
ice + mountain
cart:
wheel + wood
nerd:
human + glasses
doctor:
human + hospital
wagon:
cart + horse
newspaper:
paper + paper
paper:
wood + pressure
- deleted 9y ago[deleted]
- minus7 9y agoI wanted to see it in graph form, so a wrote I did pretty much the same but printed a dot code and piped that into dot. It was a disaster: A huge, unreadable mess. Try yourself if you're feeling adventurous: import json with open('base.560.json') as f: base = json.load(f) with open('names.560.json') as f: names = json.load(f) print('digraph {') for elnum, name in names.items(): print(f'e{elnum} [label="{name}"];') for elnum, body in base.items(): for el1, el2 in body.get('parents', ()): print(f'e{el1} -> e{elnum};') print(f'e{el2} -> e{elnum};') print('}') # python3.6 code.py | dot -Tpng dot.png