mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Updated.
This commit is contained in:
parent
679b4dec26
commit
eaade69b39
@ -68,6 +68,26 @@ if __name__ == '__main__':
|
|||||||
fd.write(os.linesep)
|
fd.write(os.linesep)
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
|
fd = file('WordStats.db', 'w')
|
||||||
|
writer = csv.writer(fd)
|
||||||
|
for filename in sys.argv[1:]:
|
||||||
|
channel = os.path.basename(filename).split('-', 1)[0]
|
||||||
|
if not ircutils.isChannel(channel):
|
||||||
|
continue
|
||||||
|
db = sqlite.connect(filename)
|
||||||
|
cursor = db.cursor()
|
||||||
|
cursor.execute("""SELECT word_stats.user_id, words.word,
|
||||||
|
word_stats.count
|
||||||
|
FROM word_stats, words""")
|
||||||
|
d = {}
|
||||||
|
for (id, word, count) in cursor.fetchall():
|
||||||
|
d.setdefault(id, {})[word] = count
|
||||||
|
for (id, d) in d.items():
|
||||||
|
L = [channel, id]
|
||||||
|
L += ['%s:%s' % (word, count) for (word, count) in d.items()]
|
||||||
|
writer.writerow(L)
|
||||||
|
fd.close()
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user