Update app.py
Browse files
app.py
CHANGED
|
@@ -635,6 +635,20 @@ def _match_staff_role(question: str):
|
|
| 635 |
if not ql:
|
| 636 |
return None
|
| 637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 638 |
role_trigger_re = re.compile(
|
| 639 |
r"\b(librarian|library director|director|manager|services?|service|systems?|technology|website|"
|
| 640 |
r"research|access|open access|orcid|bibliometric|bibliometrics|public services?|"
|
|
|
|
| 635 |
if not ql:
|
| 636 |
return None
|
| 637 |
|
| 638 |
+
# Staff role lookup only makes sense for short questions asking WHO/CONTACT
|
| 639 |
+
# Long research questions (>12 words) should never trigger this
|
| 640 |
+
if len(ql.split()) > 12:
|
| 641 |
+
return None
|
| 642 |
+
|
| 643 |
+
# Also exclude questions that are clearly research searches, not staff lookups
|
| 644 |
+
research_intent_re = re.compile(
|
| 645 |
+
r"\b(i need|find me|looking for|search for|show me|give me|"
|
| 646 |
+
r"articles?|papers?|books?|literature|how effective|how does|"
|
| 647 |
+
r"what are|what is the|impact of|effect of|based on|published)\b"
|
| 648 |
+
)
|
| 649 |
+
if research_intent_re.search(ql):
|
| 650 |
+
return None
|
| 651 |
+
|
| 652 |
role_trigger_re = re.compile(
|
| 653 |
r"\b(librarian|library director|director|manager|services?|service|systems?|technology|website|"
|
| 654 |
r"research|access|open access|orcid|bibliometric|bibliometrics|public services?|"
|