Spaces:
Sleeping
Sleeping
File size: 1,000 Bytes
20d97e8 436788b 20d97e8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
def classify_intent(text):
"""
Classifies the intent based on keyword matching (simple rule-based approach).
"""
text_lower = text.lower()
if any(word in text_lower for word in ["urgent", "emergency", "immediate", "asap", "critical"]):
return "urgent medical need"
if any(word in text_lower for word in ["appointment", "schedule", "book a visit", "doctor visit"]):
return "non-urgent appointment"
if any(word in text_lower for word in ["billing", "charge", "invoice", "cost"]):
return "billing inquiry"
if any(word in text_lower for word in ["insurance", "coverage", "policy"]):
return "insurance information"
if any(word in text_lower for word in ["pain", "health issue", "fever", "symptom", "sick"]):
return "medical advice"
return "general inquiry"
if __name__ == "__main__":
sample_text = "I need to book an appointment for my uncle who is feeling sick."
print(f"Intent: {classify_intent(sample_text)}")
|