Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. # create STW-terms based on SWA thesaurus terms
  2. # 1x1 geographical terms
  3. infile = 'data_in/690FC_geo.csv'
  4. outfile = 'data_out/650_gndgeo.seq'
  5. konkordanz = dict()
  6. swa_topic = ''
  7.  
  8. with open('konkordanzen/konk_geo_1x1.csv', newline='') as f1:
  9. for line in f1:
  10. splitted = line.split(';')
  11. if len(splitted) == 3:
  12. swa_topic1 = splitted[0]
  13. if swa_topic1 is not swa_topic:
  14. swa_topic = swa_topic1
  15. konkordanz[swa_topic] = (splitted[2].rstrip(), splitted[1])
  16.  
  17. with open (infile, newline='') as f2:
  18. with open(outfile, 'w') as f3:
  19. for line in f2:
  20. splitted = line.split(';')
  21. if splitted[1].rstrip() in konkordanz:
  22. gndgeo = konkordanz[splitted[1].rstrip()]
  23. uri = gndgeo[1].rpartition('/')[2]
  24. f3.write('{} {}{}{}{}{}{}{}\n'.format(splitted[0], '651 7 L ', '$$a', gndgeo[0], '$$1', '(DE-588)', uri, '$$2gnd'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement