Skip to content

Commit

Permalink
test for get_contributions. issue chicago-justice-project#104
Browse files Browse the repository at this point in the history
  • Loading branch information
jlherzberg committed Jul 18, 2018
1 parent 107e5b1 commit 770cb30
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/tagnews/tests/test_crimetype_tag.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tagnews

from tagnews.crimetype.tag import TAGS

class Test_Crimetype():
@classmethod
Expand All @@ -15,5 +15,13 @@ def test_tagtext_proba(self):
max_prob = probs.max()
max_type = probs.idxmax()
tags = self.model.tagtext(article,
prob_thresh=max_prob-0.001)
prob_thresh=max_prob - 0.001)
assert max_type in tags

def test_get_contributions(self):
article = 'This is an article about drugs and gangs \
written and photographed by the amazing spiderman'
contributions = self.model.get_contributions(article)

assert contributions.shape[0] == len(TAGS)
assert contributions.shape[1] == (set(article.split(' ')))

0 comments on commit 770cb30

Please sign in to comment.