hoangs's picture
Upload model.py
0154ae7 verified
def contains_polite_word(text: str) -> bool:
"""Return True if the Vietnamese text looks explicitly polite.
We check for common polite patterns like 'vui lòng', 'làm ơn', 'giúp', 'được không', 'nhé'.
"""
t = text.lower()
patterns = ["vui lòng", "làm ơn", "giúp", "được không", "nhé"]
return any(p in t for p in patterns)
if __name__ == "__main__":
tests = [
"Robot ơi, bật đèn phòng khách",
"Vui lòng hút bụi phòng ngủ nhé",
]
for t in tests:
print(repr(t), "->", contains_polite_word(t))