Skip to content

Commit 3840fa2

Browse files
committed
linted
1 parent 08baab5 commit 3840fa2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

termdoc/htdm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,6 @@ def df(self, term, prefix="", level=None):
117117
def tf_idf(self, term, address, prefix=""):
118118
if not address.startswith(prefix):
119119
raise ValueError(f"address '{address}' must start with prefix '{prefix}'")
120-
return self.tf(term, address) * log10(1 / self.df(term, prefix, level=self.depth(address) - self.depth(prefix)))
120+
return self.tf(term, address) * log10(
121+
1 / self.df(term, prefix, level=self.depth(address) - self.depth(prefix))
122+
)

tests.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,16 @@ def test_wikipedia(self):
456456

457457
c = termdoc.HTDM()
458458
c.add("1", ["this", "is", "a", "a", "sample"])
459-
c.add("2", ["this", "is", "another", "another", "example", "example", "example"])
459+
c.add(
460+
"2", ["this", "is", "another", "another", "example", "example", "example"]
461+
)
460462

461-
self.assertEqual(c.tf("this", "1"), 1/5)
462-
self.assertEqual(c.tf("this", "2"), 1/7)
463+
self.assertEqual(c.tf("this", "1"), 1 / 5)
464+
self.assertEqual(c.tf("this", "2"), 1 / 7)
463465
self.assertEqual(c.df("this"), 1)
464466
self.assertEqual(c.tf("example", "1"), 0)
465-
self.assertEqual(c.tf("example", "2"), 3/7)
466-
self.assertEqual(c.df("example"), 1/2)
467+
self.assertEqual(c.tf("example", "2"), 3 / 7)
468+
self.assertEqual(c.df("example"), 1 / 2)
467469
self.assertEqual(c.tf_idf("this", "1"), 0)
468470
self.assertEqual(c.tf_idf("this", "2"), 0)
469471
self.assertEqual(c.tf_idf("example", "1"), 0)

0 commit comments

Comments
 (0)