def classify_invoice(text): text = text.lower() if "credit note" in text: return "CREDIT_NOTE" if "tax invoice" in text and "gstin" in text: return "GST_PURCHASE" if "invoice" in text: return "SALES" return "UNKNOWN"