File size: 2,752 Bytes
dcc24f8
 
 
 
 
 
fd25f34
 
 
 
 
 
 
dcc24f8
 
 
 
 
 
 
fd25f34
 
 
 
 
 
 
 
dcc24f8
 
fd25f34
dcc24f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
"""
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
    "__version__",
    
    # Main API
    "extract",
    "FinEE",
    "get_extractor",
    
    # Data classes
    "ExtractionResult",
    "ExtractionConfig",
    "TransactionType",
    "Category",
    "Confidence",
    "ExtractionSource",
    
    # Cache
    "LRUCache",
    "get_cache",
    "clear_cache",
    "get_cache_stats",
    
    # Regex
    "RegexEngine",
    "extract_with_regex",
    
    # Merchants
    "extract_merchant_from_vpa",
    "get_category_from_merchant",
    "get_merchant_and_category",
    
    # Normalizer
    "normalize_amount",
    "normalize_date",
    "normalize_account",
    "normalize_reference",
    
    # Validator
    "repair_llm_json",
    "validate_extraction_result",
    
    # Confidence
    "calculate_confidence_score",
    "update_result_confidence",
    
    # Backends
    "get_available_backends",
    "get_backend",
]