|
|
""" |
|
|
FinEE - Finance Entity Extractor |
|
|
|
|
|
A production-ready library for extracting structured financial entities |
|
|
from Indian banking messages (SMS, email, statements). |
|
|
|
|
|
Features: |
|
|
- 🏦 Multi-Bank Support: 25+ Indian banks |
|
|
- 💳 All Transaction Types: UPI, NEFT, IMPS, Card, EMI |
|
|
- 🌐 Multilingual: English, Hindi, Tamil, Telugu, Bengali, Kannada |
|
|
- 🔍 RAG Enhanced: Context-aware extraction |
|
|
- ⚡ Fast: <1ms with regex, <100ms with LLM |
|
|
|
|
|
Example: |
|
|
>>> from finee import extract |
|
|
>>> result = extract("Rs.500 debited from A/c 1234 on 01-01-25") |
|
|
>>> print(result.amount) |
|
|
500.0 |
|
|
>>> print(result.to_json()) |
|
|
{"amount": 500.0, "type": "debit", "date": "01-01-2025", ...} |
|
|
|
|
|
Web UI: |
|
|
>>> from finee.ui import launch |
|
|
>>> launch() # Opens Gradio UI at http://localhost:7860 |
|
|
|
|
|
API Server: |
|
|
>>> from finee.api import start_server |
|
|
>>> start_server() # Starts FastAPI at http://localhost:8000 |
|
|
""" |
|
|
|
|
|
__version__ = "2.0.0" |
|
|
__author__ = "Ranjit Behera" |
|
|
|
|
|
from .schema import ( |
|
|
ExtractionResult, |
|
|
ExtractionConfig, |
|
|
TransactionType, |
|
|
Category, |
|
|
Confidence, |
|
|
ExtractionSource, |
|
|
) |
|
|
|
|
|
from .extractor import ( |
|
|
FinEE, |
|
|
extract, |
|
|
get_extractor, |
|
|
) |
|
|
|
|
|
from .cache import ( |
|
|
LRUCache, |
|
|
get_cache, |
|
|
clear_cache, |
|
|
get_cache_stats, |
|
|
) |
|
|
|
|
|
from .regex_engine import ( |
|
|
RegexEngine, |
|
|
extract_with_regex, |
|
|
) |
|
|
|
|
|
from .merchants import ( |
|
|
extract_merchant_from_vpa, |
|
|
get_category_from_merchant, |
|
|
get_merchant_and_category, |
|
|
) |
|
|
|
|
|
from .normalizer import ( |
|
|
normalize_amount, |
|
|
normalize_date, |
|
|
normalize_account, |
|
|
normalize_reference, |
|
|
) |
|
|
|
|
|
from .validator import ( |
|
|
repair_llm_json, |
|
|
validate_extraction_result, |
|
|
) |
|
|
|
|
|
from .confidence import ( |
|
|
calculate_confidence_score, |
|
|
update_result_confidence, |
|
|
) |
|
|
|
|
|
from .backends import ( |
|
|
get_available_backends, |
|
|
get_backend, |
|
|
) |
|
|
|
|
|
__all__ = [ |
|
|
|
|
|
"__version__", |
|
|
|
|
|
|
|
|
"extract", |
|
|
"FinEE", |
|
|
"get_extractor", |
|
|
|
|
|
|
|
|
"ExtractionResult", |
|
|
"ExtractionConfig", |
|
|
"TransactionType", |
|
|
"Category", |
|
|
"Confidence", |
|
|
"ExtractionSource", |
|
|
|
|
|
|
|
|
"LRUCache", |
|
|
"get_cache", |
|
|
"clear_cache", |
|
|
"get_cache_stats", |
|
|
|
|
|
|
|
|
"RegexEngine", |
|
|
"extract_with_regex", |
|
|
|
|
|
|
|
|
"extract_merchant_from_vpa", |
|
|
"get_category_from_merchant", |
|
|
"get_merchant_and_category", |
|
|
|
|
|
|
|
|
"normalize_amount", |
|
|
"normalize_date", |
|
|
"normalize_account", |
|
|
"normalize_reference", |
|
|
|
|
|
|
|
|
"repair_llm_json", |
|
|
"validate_extraction_result", |
|
|
|
|
|
|
|
|
"calculate_confidence_score", |
|
|
"update_result_confidence", |
|
|
|
|
|
|
|
|
"get_available_backends", |
|
|
"get_backend", |
|
|
] |
|
|
|