Created
December 10, 2013 15:53
-
-
Save NickMirnov/7892917 to your computer and use it in GitHub Desktop.
Прикрутка к частотному словарю Lemm по Мату.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import csv | |
d = {} | |
infil = open('lemma-freq.csv', 'r') | |
i = 0 | |
for rw in csv.reader(infil, delimiter = ';'): | |
key = rw[0] | |
value = rw[1] | |
d[key]= value | |
i = i+1 | |
if i%100000 == 0: | |
print i | |
if i == 5000000: | |
break | |
#print len(d) | |
infil.close() | |
infile = open('mat.csv', 'r') | |
for row in csv.reader(infile,delimiter = ';'): | |
freq = d.get(row[0]) | |
print freq, row[0] | |
#здесь в lemm буду искать частоту (в этом цикле) | |
# print row[0], row[1] | |
# #for s in row: | |
# #print s | |
# #table.append(row) | |
# infile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment