Spaces:
Running
Running
Create emotion.py
Browse files- utils/emotion.py +14 -0
utils/emotion.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def emotion_score(words):
|
| 2 |
+
|
| 3 |
+
strong_words = [
|
| 4 |
+
"amazing", "crazy", "insane", "love", "hate",
|
| 5 |
+
"never", "always", "big", "huge", "shocking"
|
| 6 |
+
]
|
| 7 |
+
|
| 8 |
+
score = 0
|
| 9 |
+
|
| 10 |
+
for w in words:
|
| 11 |
+
if w["text"].lower() in strong_words:
|
| 12 |
+
score += 2
|
| 13 |
+
|
| 14 |
+
return min(score, 100)
|