Update metrics.py
Browse files- metrics.py +6 -7
metrics.py
CHANGED
|
@@ -1,11 +1,5 @@
|
|
| 1 |
import re
|
| 2 |
|
| 3 |
-
def get_metrics(text):
|
| 4 |
-
return {
|
| 5 |
-
"humility_score": humility_score(text),
|
| 6 |
-
"bias_confession_rate": bias_confession_rate(text)
|
| 7 |
-
}
|
| 8 |
-
|
| 9 |
def humility_score(text):
|
| 10 |
humility_keywords = ["I may be wrong", "I don't know", "uncertain", "open to correction", "not sure"]
|
| 11 |
score = sum(1 for phrase in humility_keywords if phrase in text.lower())
|
|
@@ -15,4 +9,9 @@ def bias_confession_rate(text):
|
|
| 15 |
bias_phrases = ["I have a bias", "this may be biased", "subjective", "limited perspective", "flawed assumption"]
|
| 16 |
score = sum(1 for phrase in bias_phrases if phrase in text.lower())
|
| 17 |
return score / len(bias_phrases)
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import re
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def humility_score(text):
|
| 4 |
humility_keywords = ["I may be wrong", "I don't know", "uncertain", "open to correction", "not sure"]
|
| 5 |
score = sum(1 for phrase in humility_keywords if phrase in text.lower())
|
|
|
|
| 9 |
bias_phrases = ["I have a bias", "this may be biased", "subjective", "limited perspective", "flawed assumption"]
|
| 10 |
score = sum(1 for phrase in bias_phrases if phrase in text.lower())
|
| 11 |
return score / len(bias_phrases)
|
| 12 |
+
|
| 13 |
+
def get_metrics(text):
|
| 14 |
+
return {
|
| 15 |
+
"humility_score": humility_score(text),
|
| 16 |
+
"bias_confession_rate": bias_confession_rate(text)
|
| 17 |
+
}
|