Skip to content

Commit

Permalink
Update process.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ghobona committed Nov 18, 2024
1 parent 2f998e4 commit e76ad4f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions incubation/geolexica-tc211/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
with open("geolexica.html") as fp:
soup = BeautifulSoup(fp, 'html.parser')

cfout = open('./data/tc211/0.csv','w')

for term in soup.find_all('tr'):
filename = ''
Expand All @@ -23,12 +24,15 @@
path, headers = urlretrieve('https://isotc211.geolexica.org/api/concepts/'+termid_number+'.json', './data/json/'+filename+".json")
for name, value in headers.items():
print(name, value)


cfout.write(filename+".json"+','+label+'\n')

with open('./data/json/'+filename+".json") as f:
d = json.load(f)
fout = open('./data/tc211/'+filename+".adoc",'w')
print(filename)
fout.write("=== "+d['term']+"\n\n")
fout.write(d['eng']['definition'][0]['content']+"\n\n")
fout.write("(Source: ISO)\n\n")
fout.close()
fout.close()
cfout.close()

0 comments on commit e76ad4f

Please sign in to comment.