Skip to main content

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:
    1. Pattern & Algorithmic Rule Engine: Regex matching and checksum validation (e.g. Luhn algorithm for Credit Cards, SSN/PAN/Aadhaar formats).
    2. Contextual Heuristic & Token Parser: Structural layout analysis, address indicator tokens, title prefixes, name patterns.
    3. 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

  • EMAIL
  • PHONE
  • POSTAL_CODE
  • CREDIT_CARD
  • GOVERNMENT_ID
  • ADDRESS
  • NAME
  • UNKNOWN

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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for field-entity-analyzer 0.2.0
File Size Uploaded
field_entity_analyzer-0.2.0.tar.gz 57.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for field-entity-analyzer 0.2.0
File Interpreter ABI Platform
field_entity_analyzer-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.0 kB

Release files / field_entity_analyzer-0.2.0.tar.gz

Download URL field_entity_analyzer-0.2.0.tar.gz
Size 57.6 kB
Tags Source
SHA-256 checksum
How to use checksums
20f6cc026d4f104ab9751c12c6e4b2838464f7d3ecd3c24698a9c6745c2bf6cb
BLAKE2b-256 checksum
How to use checksums
85ed7b964f5932170d08b23de76c79c46dde33e2545ae626e7034e194915ea49
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.0-py3-none-any.whl

Download URL field_entity_analyzer-0.2.0-py3-none-any.whl
Size 54.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0553839e072328e5435fe31f9cadfb2a3deadaca719d154206f2677e4603028
BLAKE2b-256 checksum
How to use checksums
869e4d65838b2217b7fec5a108c6b4f3b5659cb78d637720c2bc7d01a46ef5d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page