12345678910111213141516171819202122232425262728293031 |
- #%%
- import json
- import csv
- from tkinter import W
- # %%
- file_lemmario = open ('/Users/leonardocanova/Library/CloudStorage/OneDrive-UniversityofPisa(1)/Documenti/Progetti università/OVI/Programmazione/OVI/power_lemmarioD.json')
- lemmario = json.load (file_lemmario)
- # %%
- print (lemmario)
- # %%
- file_link = open ('/Users/leonardocanova/Library/CloudStorage/OneDrive-UniversityofPisa(1)/Documenti/Progetti università/OVI/Programmazione/OVI/base2_clean.csv')
- link_reader = csv.DictReader (file_link)
- # %%
- link = [line for line in link_reader]
- print (link)
- # %%
- for lemma in lemmario:
- forma_standard = lemma ['lemma']['forma_standard']
- filtered_links = list(filter (lambda el : el['sLemma_clean'] == forma_standard, link))
- uris = list(map (lambda el : el ['FileHTM'], filtered_links))
- lemma ['lemma']['uri'] = uris
- # %%
- print (lemmario)
- # %%
- file_lemmario_linked = open ('/Users/leonardocanova/Library/CloudStorage/OneDrive-UniversityofPisa(1)/Documenti/Progetti università/OVI/Programmazione/OVI/power_lemmarioD_link.json', 'w')
- json.dump (lemmario, file_lemmario_linked, indent=2)
- file_lemmario.close ()
- file_lemmario_linked.close()
- # %%
|