Spaces:
Sleeping
Sleeping
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)}") | |