예제 #1
0
class TestVectorItem(unittest.TestCase):
    """ Tests the VectorItem class.

    """
    def setUp(self):
        text = u"Comment Google classe les pages Internet"

        c = Classifier(CleanTextUtil("french"))
        c.add_text(text)

        self.dictionary_db = c.dictionary_db
        self.vi = VectorItem("googl", "1")

    def tearDown(self):
        rm_data_dir()

    def test_printer(self):
        """ Tests printer.

        Create a new vector item with a word of the text.
        print the vector.

        """
        print(self.vi.printer(self.dictionary_db))

    def test_word_info(self):
        """ Tests word_info.

        Create a new vector item with a word of the text.
        Call word_info with the dictionary db:
         1- Verify the result object is a WordInfo object.  

        """
        word_info = self.vi.word_info(self.dictionary_db)
        self.assertIsInstance(word_info, WordInfo) # 1
예제 #2
0
    def setUp(self):
        text = u"Comment Google classe les pages Internet"

        c = Classifier(CleanTextUtil("french"))
        c.add_text(text)

        self.dictionary_db = c.dictionary_db
        self.vi = VectorItem("googl", "1")