freq_list.sort(reverse=True)
for freq, word in freq_list:
    print(word, freq)
f = open('wordfreq.txt', 'w')
f.write('@RELATION wordfrequencies\n')
f.write('@ATTRIBUTE word string\n')
f.write('@ATTRIBUTE frequency numeric\n')
f.write('@DATA\n')
for freq, word in freq_list[:10]:
    f.write("'%s',%d\n" % (word, freq))
f.close()
Создание ARFF из частот слов