Skip to content

Commit 485413e

Browse files
authored
Update sentiment_analyzer.py
Updated some of the E501 violations, however most aren't able to be addressed.
1 parent 0f7cf66 commit 485413e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

nlp-sentiment-analysis/sentiment_analyzer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
sitcom-like in those scenes. When Toni Colette walks out and ponders
1010
life silently, it's gorgeous.<br /><br />The movie doesn't seem to decide
1111
whether it's slapstick, farce, magical realism, or drama, but the best of it
12-
doesn't matter. (The worst is sort of tedious - like Office Space with less humor.)
12+
doesn't matter. (The worst is sort of tedious - like Office Space with
13+
less humor.)
1314
"""
1415

1516

@@ -67,9 +68,11 @@ def evaluate_model(tokenizer, textcat, test_data: list) -> dict:
6768
for i, review in enumerate(textcat.pipe(reviews)):
6869
true_label = labels[i]["cats"]
6970
for predicted_label, score in review.cats.items():
71+
# Every `cats` dictionary includes both labels, you
72+
# can get all the info we need with just the pos label
7073
if (
7174
predicted_label == "neg"
72-
): # Every `cats` dictionary includes both labels, you can get all the info we need with just the pos label
75+
):
7376
continue
7477
if score >= 0.5 and true_label["pos"]:
7578
true_positives += 1

0 commit comments

Comments
 (0)