{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "source": [ "# 🏦 FinEE - Finance Entity Extractor\n", "\n", "**Extract structured financial data from Indian banking messages in seconds.**\n", "\n", "This notebook demonstrates the `finee` Python package - a production-ready tool for parsing bank transaction messages." ], "metadata": { "id": "intro" } }, { "cell_type": "markdown", "source": [ "## 📦 Installation\n", "\n", "Install the package directly from PyPI:" ], "metadata": { "id": "install_header" } }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "install" }, "outputs": [], "source": [ "!pip install finee -q" ] }, { "cell_type": "markdown", "source": [ "## 🚀 Quick Demo\n", "\n", "Let's extract entities from a real HDFC Bank UPI transaction message:" ], "metadata": { "id": "demo_header" } }, { "cell_type": "code", "source": [ "from finee import extract\n", "\n", "# Sample HDFC Bank UPI transaction\n", "message = \"\"\"\n", "HDFC Bank: Rs.2,500.00 debited from A/c XX3545 on 28-12-2025.\n", "VPA: swiggy@ybl. UPI Ref: 534567891234.\n", "Not you? Call 18002586161\n", "\"\"\"\n", "\n", "# Extract entities (uses Regex + Rules, no GPU needed)\n", "result = extract(message)\n", "\n", "# Print structured output\n", "print(\"📊 Extracted Entities:\")\n", "print(f\" Amount: ₹{result.amount}\")\n", "print(f\" Type: {result.type}\")\n", "print(f\" Account: ****{result.account}\")\n", "print(f\" Date: {result.date}\")\n", "print(f\" Reference: {result.reference}\")\n", "print(f\" Merchant: {result.merchant}\")\n", "print(f\" Category: {result.category}\")\n", "print(f\" Confidence: {result.confidence.value}\")" ], "metadata": { "id": "demo_hdfc" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## 📄 JSON Output\n", "\n", "Get the result as a clean JSON object:" ], "metadata": { "id": "json_header" } }, { "cell_type": "code", "source": [ "import json\n", "\n", "# Export as JSON\n", "json_output = result.to_dict()\n", "print(json.dumps(json_output, indent=2))" ], "metadata": { "id": "json_output" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## 🏦 Multi-Bank Support\n", "\n", "FinEE works across all major Indian banks:" ], "metadata": { "id": "multibank_header" } }, { "cell_type": "code", "source": [ "banks = {\n", " \"ICICI\": \"Dear Customer, Rs.1500 debited from Acct XX9876 on 15-01-2025 to amazon@apl. Ref: 987654321012\",\n", " \"SBI\": \"SBI: Rs.350 debited from a/c XX1234 on 10-01-25. UPI txn to zomato@paytm. Ref: 456789012345\",\n", " \"Axis\": \"Axis Bank: INR 800 debited from A/c 5678 on 05-01-2025. Info: UPI-UBER. Bal: Rs.12,500\",\n", " \"Kotak\": \"Rs.2000 credited to Kotak A/c XX4321 on 20-01-2025 from rahul.sharma@okicici. Ref: 321654987012\"\n", "}\n", "\n", "print(\"🏦 Multi-Bank Extraction Results:\\n\")\n", "for bank, msg in banks.items():\n", " r = extract(msg)\n", " print(f\"{bank:6} | ₹{str(r.amount):>8} | {r.type:6} | {(r.merchant or 'N/A'):12} | {r.confidence.value}\")" ], "metadata": { "id": "multibank_demo" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## ⚡ Performance\n", "\n", "The Regex+Rules pipeline is blazing fast:" ], "metadata": { "id": "perf_header" } }, { "cell_type": "code", "source": [ "import time\n", "\n", "# Benchmark\n", "test_msg = \"Rs.500 debited from A/c 1234 to paytm@ybl on 01-01-2025\"\n", "\n", "start = time.time()\n", "for _ in range(1000):\n", " extract(test_msg)\n", "elapsed = (time.time() - start) * 1000 # ms\n", "\n", "print(f\"⚡ 1000 extractions in {elapsed:.1f}ms\")\n", "print(f\" Average: {elapsed/1000:.3f}ms per message\")\n", "print(f\" Throughput: {1000000/elapsed:.0f} messages/second\")" ], "metadata": { "id": "benchmark" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## 📚 Learn More\n", "\n", "- 📦 **PyPI**: `pip install finee`\n", "- 🐙 **GitHub**: [Ranjitbehera0034/Finance-Entity-Extractor](https://github.com/Ranjitbehera0034/Finance-Entity-Extractor)\n", "- 🤗 **Model**: [Ranjit0034/finance-entity-extractor](https://huggingface.co/Ranjit0034/finance-entity-extractor)" ], "metadata": { "id": "links" } } ] }