more docs and start of knn with python mysql
This commit is contained in:
parent
0eea55bcad
commit
580dafac54
|
@ -50,7 +50,7 @@ class NGramSet:
|
|||
def print_mysql(self):
|
||||
table_name = re.sub('[^A-Za-z0-9]', '_', "%s_%d" % (self.filename, self.gram_size))
|
||||
print "DROP TABLE IF EXISTS %s;" % (table_name)
|
||||
print "CREATE TABLE %s (gram VARCHAR(255), count INT, percent FLOAT, PRIMARY KEY(gram));" % (table_name)
|
||||
print "CREATE TABLE %s (gram VARCHAR(255), count INT DEFAULT 0, percent FLOAT DEFAULT 0.0, PRIMARY KEY(gram));" % (table_name)
|
||||
for key in self.gram_set:
|
||||
print "INSERT INTO %s VALUES (\"%s\", %d, %f);" % (table_name, key, self.gram_set[key]['count'], self.gram_set[key]['percent'])
|
||||
|
||||
|
|
Loading…
Reference in New Issue