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.
Release files for field-entity-analyzer 0.2.2
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.2.2.tar.gz | 57.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| field_entity_analyzer-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 112.3 kB
Release files / field_entity_analyzer-0.2.2.tar.gz
| Download URL | field_entity_analyzer-0.2.2.tar.gz |
|---|---|
| Size | 57.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65d220474d2d4c09a21f75657267aa8a97ee93a438bc447a8342ace33b8eb9b1
|
|
BLAKE2b-256 checksum How to use checksums |
4ec24dbe2228822fbb21d4b5baff608356550e3c8787a18619b1c95ef6204251
|
| 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.2.2-py3-none-any.whl
| Download URL | field_entity_analyzer-0.2.2-py3-none-any.whl |
|---|---|
| Size | 54.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ef95115f5a29b99d386363690e18991aed13dfb443a180296b30f489d993817
|
|
BLAKE2b-256 checksum How to use checksums |
8fba8c6c22bc7f5c2005b09e4f496b9d7c6ea37094893078a365e55e866455d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|