You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
398 B
Python

import unittest
import nltk
class TestFreqDist(unittest.TestCase):
def test_iterating_returns_an_iterator_ordered_by_frequency(self):
samples = ['one', 'two', 'two']
distribution = nltk.FreqDist(samples)
most_frequent, less_frequent = [entry for entry in distribution]
self.assertEqual(most_frequent, 'two')
self.assertEqual(less_frequent, 'one')