Metadata-Version: 2.4
Name: smith-utils
Version: 0.2.1
Summary: A utility library for data cleaning and parsing.
Author-email: Eiichi YAMAMOTO <info@yeiichi.com>
License: MIT License
        
        Copyright (c) 2026 Eiichi YAMAMOTO 
        
        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/yeiichi/smith-utils
Project-URL: Repository, https://github.com/yeiichi/smith-utils
Project-URL: Documentation, https://smith-utils.readthedocs.io/
Project-URL: Changelog, https://smith-utils.readthedocs.io/en/latest/changelog.html
Keywords: csv,deduplication,data-filtering,file-organization,filtering
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: docs
Requires-Dist: sphinx<9,>=8; extra == "docs"
Requires-Dist: furo>=2024.8.6; extra == "docs"
Provides-Extra: release
Requires-Dist: python-semantic-release<10,>=9; extra == "release"
Dynamic: license-file

# smith-utils
[![PyPI version](https://img.shields.io/pypi/v/smith-utils.svg)](https://pypi.org/project/smith-utils/)
![Python versions](https://img.shields.io/pypi/pyversions/smith-utils.svg)
![Status](https://img.shields.io/badge/status-Alpha-orange.svg)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Tests](https://img.shields.io/badge/tests-passing-brightgreen.svg)
[![Documentation Status](https://readthedocs.org/projects/smith-utils/badge/?version=latest)](https://smith-utils.readthedocs.io/en/latest/?badge=latest)


**Smith Utils** is a central hub for data cleaning and parsing scripts. 
This package consolidates distributed utility functions to improve code reuse and maintenance efficiency across all yeiichi projects.

## Key Features

### 📅 Datetime Utilities (`smith_utils.datetime`)
Robust date parsing and formatting.
- `ensure_date`: Flexible conversion of strings, `datetime.date` objects, or `None` (returns today) into a `date` object.
- `parse_strict_date`: Strict parsing for `YYYYMMDD` or `YYYY-MM-DD` formats, rejecting ambiguous inputs.
- `format_ordinal`: Converts integers to ordinal strings (e.g., `1` → `"1st"`, `22` → `"22nd"`).

### 🔢 Numeric Refinement (`smith_utils.numeric`)
Clean and parse messy numeric data.
- `parse_numeric_value`: Handles custom separators, decimals, and negative formats like `(1,234.56)`.
- `parse_currency_value`: Alias for numeric parsing, specifically for currency strings.

### 📝 Text Normalization & Metrics (`smith_utils.text`)
Standardize text and compare string similarity.
- `normalize_text`: Unicode NFKC normalization, case folding, and whitespace handling.
- `StringDistance`: Implementation of Damerau-Levenshtein and Jaro-Winkler algorithms for fuzzy matching.
- `make_unicode_char_name_records`: Extract Unicode codepoint/name metadata from text.

## Installation

Install via pip:

```bash
pip install smith-utils
```

## Quick Start

```python
from smith_utils import ensure_date, parse_numeric_value, normalize_text
from smith_utils import make_unicode_char_name_records

# Datetime
date = ensure_date("20231225") # datetime.date(2023, 12, 25)

# Numeric
value = parse_numeric_value("(1,250.50)") # -1250.5

# Text
clean_text = normalize_text("  Ｓｍｉｔｈ  Ｕｔｉｌｓ  ") # "smith utils"

# Unicode metadata
records = make_unicode_char_name_records("Aあ")
# [UnicodeCharNameRecord(index=0, codepoint='U+0041', ...), ...]
```

## Directory Structure
- `src/smith_utils/`: Main package source.
- `legacy/`: Legacy scripts and templates (not included in distribution).
- `tests/`: Comprehensive test suite.

## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
