MCPcopy Index your code
hub / github.com/clips/pattern / test_tf

Method test_tf

test/test_vector.py:314–320  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

312 print "pattern.vector.Document.keywords()"
313
314 def test_tf(self):
315 # Assert Document.term_frequency() (= weights used in Vector for orphaned documents).
316 v = vector.Document("the cat sat on the mat")
317 for feature, weight in v.vector.items():
318 self.assertEqual(v.term_frequency(feature), weight)
319 self.assertAlmostEqual(v.term_frequency(feature), 0.33, places=2)
320 print "pattern.vector.Document.tf()"
321
322 def test_tfidf(self):
323 # Assert tf-idf for documents not in a model.

Callers

nothing calls this directly

Calls 2

term_frequencyMethod · 0.95
itemsMethod · 0.45

Tested by

no test coverage detected