Metadata-Version: 2.4
Name: humanmint
Version: 0.1.11
Summary: Clean, functional data processing for human-centric applications. Normalize and standardize names, emails, phones, departments, and job titles with a single unified API.
Author: Ricardo Nunes
License: MIT License
        
        Copyright (c) 2025 Ricardo Nunes
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/RicardoNunes2000/HumanMint
Project-URL: Documentation, https://github.com/RicardoNunes2000/HumanMint/blob/main/README.md
Project-URL: Bug Tracker, https://github.com/RicardoNunes2000/HumanMint/issues
Project-URL: Source Code, https://github.com/RicardoNunes2000/HumanMint
Keywords: data-processing,normalization,names,emails,phones,departments,titles,civic-data
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Office/Business
Classifier: Topic :: Text Processing
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: email-validator>=2.0.0
Requires-Dist: phonenumbers>=8.13.0
Requires-Dist: nameparser>=1.1.0
Requires-Dist: nicknames>=0.0.2
Requires-Dist: rapidfuzz>=3.6
Requires-Dist: importlib_resources>=5.0; python_version < "3.9"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: flake8>=6.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: faker>=20.0; extra == "dev"
Provides-Extra: address
Requires-Dist: usaddress>=0.6.0; extra == "address"
Provides-Extra: pandas
Requires-Dist: pandas>=1.5; extra == "pandas"
Dynamic: license-file

# HumanMint

**Clean, normalized contact data in one line of code.**

Standardize names, emails, phones, addresses, departments, job titles, and organizations with intelligent parsing and fuzzy matching.

```python
from humanmint import mint

result = mint(
    name="Dr. John Q. Smith, PhD",
    email="JOHN.SMITH@CITY.GOV",
    phone="(202) 555-0173 ext 456",
    department="001 - Public Works Dept",
    title="Chief of Police"
)

print(result.name_str)          # "John Q Smith"
print(result.email_str)         # "john.smith@city.gov"
print(result.phone_str)         # "+1 202-555-0173"
print(result.department_str)    # "Public Works"
print(result.title_str)         # "police chief"
```

## Why HumanMint?

Real-world contact data is **messy**:
- Names with titles: `"Dr. Jane Smith, PhD"`
- Inconsistent formatting: `"JOHN@EXAMPLE.COM"` vs `"john.smith@example.com"`
- Phone number variations: `"(202) 555-0101 x101"` vs `"202.555.0101"`
- Departments with noise: `"000171 - Public Works 202-555-0150 ext 200"`
- Abbreviated titles: `"Sr. Water Engr."`

**HumanMint handles all of this** with zero configuration.

## Installation

```bash
pip install humanmint
```

## Key Features

- **Names:** Parse, normalize, infer gender, detect nicknames, strip titles
- **Emails:** Validate, normalize, detect free providers (Gmail, Yahoo, etc.)
- **Phones:** Format (E.164), extract extensions, validate, detect type (mobile/landline)
- **Departments:** Canonicalize, categorize, fuzzy match (23K+ dept names → 64 categories)
- **Titles:** Standardize, match against curated list (100K+ job titles), confidence scores
- **Addresses:** Parse US postal addresses (street, city, state, ZIP)
- **Organizations:** Normalize agency/org names
- **Comparison:** `compare(result_a, result_b)` for deduplication with 0-100 similarity scores
- **Batch:** Parallel processing with `bulk(records, workers=4)` for high throughput
- **Export:** JSON, CSV, Parquet, SQL with flatten option for direct database import

## Quick Examples

### Field Accessor Reference

All fields provide three access patterns:

| Pattern | Example | Description |
|---------|---------|-------------|
| Dict access | `result.title["canonical"]` | Access specific processing stages |
| Property | `result.title_str` | Shorthand for canonical/standardized form |
| Full dict | `result.title` | All stages: raw, normalized, canonical, is_valid |

Common `_str` properties: `name_str`, `email_str`, `phone_str`, `department_str`, `title_str`

### Accessing title fields

```python
result = mint(title="Chief of Police")

# Dict access - different processing stages
result.title["raw"]         # "Chief of Police" (original input)
result.title["normalized"]  # "Chief of Police" (cleaned)
result.title["canonical"]   # "police chief" (standardized form)
result.title["is_valid"]    # True

# Shorthand properties
result.title_str            # "police chief" (same as canonical)
result.title_normalized     # "Chief of Police"
```

### Comparing records

```python
from humanmint import compare

r1 = mint(name="John Smith", email="john@example.com")
r2 = mint(name="Jon Smith", email="john.smith@example.com")

score = compare(r1, r2)  # Returns 0-100 similarity score
# Typically: >85 = likely duplicate, >70 = similar, <50 = different
```

### Batch processing

```python
from humanmint import bulk

records = [
    {"name": "Alice", "email": "alice@example.com"},
    {"name": "Bob", "email": "bob@example.com"},
]

results = bulk(records, workers=4, progress=True)
```

## Performance

| Dataset | Time | Per Record | Throughput |
|---------|------|-----------|-----------|
| 1,000 | 561 ms | 0.56 ms | 1,783 rec/sec |
| 10,000 | 3.1 s | 0.31 ms | 3,178 rec/sec |
| 50,000 | 14.0 s | 0.28 ms | 3,576 rec/sec |

## Documentation

- **[API Reference](docs/API.md)** — Full function documentation
- **[Use Cases](docs/use_cases/)** — Real-world examples (Government contacts, HR, Salesforce, etc.)
- **[Fields Guide](docs/FIELDS.md)** — Access all returned fields
- **[Advanced](docs/ADVANCED.md)** — Custom weights, overrides, batch export

## CLI

```bash
humanmint clean input.csv output.csv --name-col name --email-col email
```

## Testing

```bash
pytest -q unittests
```

## License

MIT
