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.1
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.1.tar.gz | 57.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| field_entity_analyzer-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 112.2 kB
Release files / field_entity_analyzer-0.2.1.tar.gz
| Download URL | field_entity_analyzer-0.2.1.tar.gz |
|---|---|
| Size | 57.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ce7bb6e888ba0384c9dfd084ea0ec33cfde4afe252eb454c81f748025e83a5eb
|
|
BLAKE2b-256 checksum How to use checksums |
821c2f8830641743c411190d07689f7e6c019b10678a14cc0d84571531f4bb9c
|
| 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.1-py3-none-any.whl
| Download URL | field_entity_analyzer-0.2.1-py3-none-any.whl |
|---|---|
| Size | 54.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8027194a8187d87b5aca00674d43213b32534c8121b2c695d9dfa144d908b35
|
|
BLAKE2b-256 checksum How to use checksums |
bd5c38810c83b928b43a93cffa17c2964c176a718ef0743a31c9599b46a4081d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|