Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. from sys import stdin
  5.  
  6. for line in stdin:
  7. line = line.strip()
  8.  
  9. if line == '':
  10. print
  11. else:
  12. wf, feats, lemma, label, ann = line.split('\t')
  13. lemma_list = eval(ann)
  14.  
  15. l = '|'.join([lemma for label_, lemma in lemma_list if label_==label])
  16.  
  17. if l != '':
  18. lemma = l
  19.  
  20. lemma = lemma.lower()
  21. lemma = lemma.replace('Å', 'å')
  22. lemma = lemma.replace('Ä', 'ä')
  23. lemma = lemma.replace('Ö', 'ö')
  24.  
  25. print ("%s\t%s\t%s\t%s\t_" % (wf, feats, lemma, label))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement