Esempio n. 1
0
 def test_document_vector(self):
     factory = DocumentFactory()
     d1 = factory.new(['a', 'b', 'c'])
     d2 = factory.new(['b', 'd', 'e'])
     print(factory.nums)
     self.assertEqual(
         'Document(1, SupportVector({1: 1.0, 2: 1.0, 3: 1.0}))', str(d1))
     self.assertEqual(
         'Document(2, SupportVector({2: 1.0, 4: 1.0, 5: 1.0}))', str(d2))
Esempio n. 2
0
def getDocs():
    f = DocumentFactory()
    return [
        f.new(x.split()) for x in [
            "this is a nice long document",
            "this is another nice long document",
            "this is rather a short document", "a horrible document",
            "another horrible document"
        ]
    ]
Esempio n. 3
0
def get_docs():
    f = DocumentFactory()
    return [
        f.new(x.split()) for x in [
            'this is a nice long document',
            'this is another nice long document',
            'this is rather a short document', 'a horrible document',
            'another horrible document'
        ]
    ]
Esempio n. 4
0
 def test_document_nums(self):
     factory = DocumentFactory()
     d1 = factory.new([1, 2, 3])
     d2 = factory.new([4, 5, 6])
     self.assertEqual(1, d1.docnum)
     self.assertEqual(2, d2.docnum)