Field Entity Analyzer
field_entity_analyzer is a high-performance, 100% offline, self-contained Python library for identifying and classifying entity types from input strings (such as Email, Phone Number, Postal Code, Credit Card, Government ID, Address, and Person Name).
Key Features
- 100% Offline & Private: Zero network requests, zero external web service dependencies.
- Ultra Lightweight: Embedded model weights packaged inside binary wheel (< 1 MB wheel size).
- Multi-Engine Cascading Architecture:
- Pattern & Algorithmic Rule Engine: Regex matching and checksum validation (e.g. Luhn algorithm for Credit Cards, SSN/PAN/Aadhaar formats).
- Contextual Heuristic & Token Parser: Structural layout analysis, address indicator tokens, title prefixes, name patterns.
- Lightweight Embedded Classifier: Fast, pre-trained character and token feature classifier asset embedded inside the package.
- Python 3.8+ Compatibility: Clean, typed, dependency-light package.
Supported Entity Types
EMAILPHONEPOSTAL_CODECREDIT_CARDGOVERNMENT_IDADDRESSNAMEUNKNOWN
Installation
pip install field_entity_analyzer
Or install from source:
git clone https://github.com/example/field_entity_analyzer.git
cd field_entity_analyzer
pip install .
Quick Start
from field_entity_analyzer import EntityAnalyzer, analyze_entity
# 1. Using top-level convenience function
result = analyze_entity("john.doe@example.com")
print(result.entity_type) # EntityType.EMAIL
print(result.confidence) # 1.0
print(result.engine) # "rules"
# 2. Using EntityAnalyzer instance
analyzer = EntityAnalyzer()
samples = [
"4532 0151 1283 0366",
"+1 (555) 234-5678",
"123 Main Street, Apt 4B, Springfield",
"Dr. Alexander Hamilton",
"90210",
"123-45-6789",
]
for text in samples:
res = analyzer.analyze(text)
print(f"'{text}' -> {res.entity_type.value} (conf: {res.confidence:.2f}, engine: {res.engine})")
Architecture Overview
┌─────────────────────────────────────────────────────────────┐
│ Input String │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Engine 1: Pattern & Algorithmic Rule Engine │
│ - Compiled Regex for Email, Phone, Postal Code │
│ - Checksum & Format Validation for ID numbers & Cards │
└──────────────────────────────┬──────────────────────────────┘
│ (If no deterministic match)
▼
┌─────────────────────────────────────────────────────────────┐
│ Engine 2: Contextual Heuristic & Token Parser │
│ - Address Suffix & Indicator Matching (Street, Road, Apt) │
│ - Person Name Structure Analysis (Title Case, Capitalized) │
└──────────────────────────────┬──────────────────────────────┘
│ (Fallback)
▼
┌─────────────────────────────────────────────────────────────┐
│ Engine 3: Lightweight Embedded Classifier │
│ - Pre-trained compressed model file inside package assets │
│ - Located at `src/field_entity_analyzer/assets/` (< 1 MB) │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Output: Classification Result `{entity_type, confidence}` │
└─────────────────────────────────────────────────────────────┘
License
MIT License.
Metadata
Release files for field-entity-analyzer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| field_entity_analyzer-0.1.0.tar.gz | 54.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| field_entity_analyzer-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.1 kB
Release files / field_entity_analyzer-0.1.0.tar.gz
| Download URL | field_entity_analyzer-0.1.0.tar.gz |
|---|---|
| Size | 54.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2662d93c08269f776157e54ebc231455902a6228339cf5e09c34cf33ad70ac3e
|
|
BLAKE2b-256 checksum How to use checksums |
777c1e78b007ddc90793e9152b2a881288e9414083f5c21def52af9ab492fdfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / field_entity_analyzer-0.1.0-py3-none-any.whl
| Download URL | field_entity_analyzer-0.1.0-py3-none-any.whl |
|---|---|
| Size | 51.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81c8482f6fae57a7525077d6b6d8e726e0495888e45e072d1cc2144fda5fa689
|
|
BLAKE2b-256 checksum How to use checksums |
11534bcd8a3ff75a9291fec034da7cf246253b67cfd0fbf7b0918861a8ca6c71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|