1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| >>> inFile = open('c:/Python27/Corpus/corpus/fv701011.pos','r')
>>> inRead = inFile.read()
>>> import re
>>> def dic (data):
lemmata_sprekercodes = {}
data_splitted = data.split('>\n<au')
for x in data_splitted:
a = re.findall(r'<BW.+?;.+?>', x)
a2 = ",".join(a)
a3=re.findall(r';.+?>',a2)
a4 = ",".join(a3)
a5 = re.findall (r'(?<=;).+?(?=>)',a4)
b = re.findall(r's=".+?"', x)
b2 = ','.join(b)
b3=b2.replace('s=','')
b4=b3.replace('"','')
c = re.findall(r'id=.+?"',x)
c2 = ','.join(c)
c3 = c2.replace('id=','')
c4=c3.replace('"','')
lemmata_sprekercodes_sub = {}
for y in a5:
lemmata_sprekercodes_sub[y] = b4
lemmata_sprekercodes[c4] = lemmata_sprekercodes_sub
return lemmata_sprekercodes
>>> dictionary = dic(inRead)
>>> dictionary
{'217': {'misschien': 'V60921'}, '214': {'liever': 'V60907', 'vanavond': 'V60907', 'niet': 'V60907'}, '215': {'liever': 'V60921', 'niet': 'V60921'}, '212': {'dus': 'V60907', 'vandaag': 'V60907', 'ook': 'V60907'}, '213': {'vanavond': 'V60921'}, '210': {'morgen': 'V60907'}, '264': {'zo': 'V60921'}, '265': {'terug': 'V60907'}, '218': {'morgenavond': 'V60921', 'dus': 'V60921'}, '219': {'morgenavond': 'V60907', 'niet': 'V60907'}, '132': {'zo': 'V60907'}, '131': {'dan': 'V60907'}, '137': {'niet': 'V60921'}, '138': {'en': 'V60921', 'niet': 'V60921', 'nu': 'V60921'}, '93': {'eens': 'V60921'}, '22': {'morgen': 'V60907'}, '28': {'nog': 'V60921', 'wel': 'V60921'}, '29': {'morgenavond': 'V60921'}, '344': {'nog': 'V60921', 'niet': 'V60921'}, '345': {'dus': 'V60921'}, '281': {'niet': 'V60907'}, '8': {'ook': 'V60907'}, '285': {'eerder': 'V60907', 'azo': 'V60907'}, '349': {'maandagavond': 'V60921', 'dan': 'V60921'}, '286': {'dus': 'V60907'}, '261': {'dus': 'V60907', 'zelfs': 'V60907'}, '123': {'niet': 'V60907', 'nu': 'V60907', 'ook': 'V60907'}, '124': {'vanavond': 'V60921'}, '266': {'dan': 'V60921', 'daarna': 'V60921'}, '126': {'toch': 'V60921', 'te': 'V60921', 'ook': 'V60921'}, '127': {'dan': 'V60907', 'toch': 'V60907', 'wel': 'V60907'}, '269': {'te': 'V60921', 'niet': 'V60921'}, '58': {'al': 'V60921', 'misschien': 'V60921'}, '54': {'dus': 'V60907'}, '51': {'niet': 'V60921'}, '53': {'tussenin': 'V60907'}, '296': {'daarna': 'V60907'}, '295': {'dan': 'V60921', 'daarna': 'V60921'}, '293': {'dan': 'V60921'}, '201': {'pas': 'V60921'}, '319': {'zo': 'V60907'}, '198': {'dus': 'V60907', 'niet': 'V60907', 'ook': 'V60907', 'wel': 'V60907'}, '312': {'al': 'V60907'}, '196': {'zo': 'V60907', 'nu': 'V60907', 'ook': 'V60907', 'al': 'V60907'}, '144': {'niet': 'V60921', 'maar': 'V60921'}, '192': {'toch': 'V60907', 'niet': 'V60907'}, '270': {'dan': 'V60907'}, '271': {'ook': 'V60907'}, '117': {'dus': 'V60921', 'nu': 'V60921', 'zelfs': 'V60921'}, '116': {'erbij': 'V60907', 'toen': 'V60907'}, '111': {'dan': 'V60921', 'dus': 'V60921', 'morgen': 'V60921', 'desnoods': 'V60921'}, '113': {'zelfs': 'V60907'}, '112': {'tenslotte': 'V60907', 'awel': 'V60907'}, '279': {'nog': 'V60921', 'desnoods': 'V60921'}, '80': {'vooral': 'V60907'}, '81': {'dan': 'V60907'}, '118': {'nog': 'V60907', 'dus': 'V60907'}, '85': {'niet': 'V60907'}, '207': {'nog': 'V60907'}, '179': {'helemaal': 'V60907', 'dan': 'V60907'}, '366': {'wel': 'V60907'}, '362': {'anders': 'V60907'}, '361': {'dan': 'V60921'}, '309': {'anders': 'V60907'}, '304': {'dan': 'V60907'}, '302': {'vooruit': 'V60907'}, '225': {'niet': 'V60907'}, '109': {'te': 'V60921'}, '240': {'dan': 'V60907'}, '243': {'dus': 'V60921'}, '106': {'namelijk': 'V60921', 'zo': 'V60921', 'niet': 'V60921'}, '248': {'niet': 'V60907'}, '104': {'dan': 'V60921', 'allemaal': 'V60921', 'ook': 'V60921'}, '38': {'morgen': 'V60921'}, '33': {'toch': 'V60921', 'zo': 'V60921'}, '32': {'wel': 'V60921'}, '31': {'zo': 'V60907', 'ook': 'V60907'}, '30': {'niet': 'V60921'}, '36': {'juist': 'V60907'}, '338': {'zo': 'V60921'}, '330': {'niet': 'V60907'}, '332': {'niet': 'V60921', 'ook': 'V60921'}, '60': {'waarvoor': 'V60907'}, '66': {'soms': 'V60907', 'niet': 'V60907', 'dan': 'V60907'}, '178': {'niet': 'V60921', 'nu': 'V60921'}, '171': {'niet': 'V60921'}, '180': {'ook': 'V60921'}, '2': {'zo': 'V60907', 'wel': 'V60907'}, '6': {'toch': 'V60921', 'wel': 'V60921'}, '188': {'zo': 'V60907', 'niet': 'V60907', 'altijd': 'V60907', 'ook': 'V60907'}, '185': {'zo': 'V60907', 'trouwens': 'V60907'}, '98': {'te': 'V60921', 'niet': 'V60921'}, '168': {'dan': 'V60907'}, '280': {'ook': 'V60907'}, '164': {'niet': 'V60921'}, '90': {'niet': 'V60921'}, '166': {'dus': 'V60921', 'niet': 'V60921'}, '224': {'dan': 'V60907', 'zelf': 'V60907'}, '95': {'zo': 'V60921'}, '161': {'niet': 'V60921', 'waarover': 'V60921'}, '221': {'terug': 'V60907', 'morgenvroeg': 'V60907', 'morgen': 'V60907', 'al': 'V60907'}, '96': {'nog': 'V60921', 'ook': 'V60921'}, '10': {'niet': 'V60921'}, '13': {'ook': 'V60921'}, '12': {'toch': 'V60921'}, '14': {'zo': 'V60921', 'misschien': 'V60921'}, '16': {'niet': 'V60907', 'ook': 'V60907'}, '272': {'wel': 'V60921'}, '273': {'desnoods': 'V60921'}, '274': {'zo': 'V60921', 'ook': 'V60921'}, '151': {'en': 'V60921'}, '150': {'niet': 'V60921'}, '153': {'niet': 'V60921'}, '152': {'niet': 'V60921'}, '154': {'zo': 'V60921'}, '157': {'dan': 'V60907'}, '158': {'dan': 'V60921'}, '239': {'dus': 'V60907', 'ook': 'V60907'}, '235': {'terug': 'V60921'}, '236': {'dan': 'V60921', 'dus': 'V60921'}, '231': {'terug': 'V60907', 'dus': 'V60907', 'al': 'V60907'}, '44': {'nog': 'V60921', 'hoe': 'V60921', 'ook': 'V60921', 'wel': 'V60921'}, '45': {'nog': 'V60921', 'niet': 'V60921'}, '40': {'dan': 'V60907'}, '41': {'dan': 'V60921'}, '328': {'wel': 'V60921'}, '146': {'hoe': 'V60921'}, '203': {'wanneer': 'V60907'}, '202': {'pas': 'V60907', 'inderdaad': 'V60907'}, '205': {'nog': 'V60921', 'vanavond': 'V60921', 'niet': 'V60921'}, '204': {'anders': 'V60907'}, '140': {'waarom': 'V60921', 'niet': 'V60921', 'wel': 'V60921'}, '206': {'dus': 'V60921', 'nu': 'V60921'}, '209': {'morgen': 'V60907'}, '148': {'dan': 'V60921', 'nog': 'V60921', 'wel': 'V60921'}, '149': {'wel': 'V60921'}, '75': {'foefeldefoefel': 'V60907'}, '74': {'dus': 'V60907'}, '73': {'niet': 'V60907'}, '72': {'nog': 'V60921'}, '71': {'vooral': 'V60907'}, '79': {'niet': 'V60907'}, '355': {'dan': 'V60907'}, '353': {'nog': 'V60921'}, '352': {'nog': 'V60921', 'niet': 'V60921', 'ook': 'V60921', 'wel': 'V60921'}, '350': {'morgen': 'V60907', 'niet': 'V60907', 'vrij': 'V60907', 'al': 'V60907'}, '267': {'te': 'V60907', 'niet': 'V60907'}, '359': {'nog': 'V60921'}} |
Partager