Spaces:
Sleeping
Sleeping
Create client_first.py
Browse files- nlp/client_first.py +15 -0
nlp/client_first.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .detectors import personalization_density, fiduciary_flag, product_push_penalty
|
| 2 |
+
|
| 3 |
+
def score(text: str):
|
| 4 |
+
pd = personalization_density(text)
|
| 5 |
+
fid = fiduciary_flag(text)
|
| 6 |
+
ppush = product_push_penalty(text)
|
| 7 |
+
|
| 8 |
+
sub = 0.35*pd + 0.25*fid + 0.25*(1 if fid else 0) - 0.25*ppush
|
| 9 |
+
sub = max(0.0, min(1.0, sub))
|
| 10 |
+
return {
|
| 11 |
+
'subscore': sub,
|
| 12 |
+
'personalization_density': pd,
|
| 13 |
+
'fiduciary_flag': fid,
|
| 14 |
+
'product_push_penalty': ppush,
|
| 15 |
+
}
|