Skip to content

Commit 542f211

Browse files
author
self
committed
Fixed bug where NLTK test ringed 'no' as potentially problematic. You can now say no the bot to your hearts desire.
1 parent 8ec3bb1 commit 542f211

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chatbot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def hostile_or_personal(text: str) -> bool:
171171
named_entities.append(chunk.label())
172172

173173
# Check for manipulation
174-
if (negative_score > 0.5) or ('PERSON' in named_entities and negative_score > 0.3):
174+
if ((negative_score > 0.5) or ('PERSON' in named_entities and negative_score > 0.3)) and len(text[:-1]) > 2:
175175
return True
176176
else:
177177
return False

0 commit comments

Comments
 (0)