Skip to main content

PurifyLLM

CLI and pre-commit hook to normalize “smart” punctuation and invisible Unicode produced by LLMs.

What it does

Replaces common UTF-8 special characters with safe equivalents:

  • smart quotes “ ” ‘ ’ -> " and '
  • dashes – — − -> -
  • ellipsis … -> ...
  • non-breaking spaces and thin spaces -> regular space
  • zero-width and BOM characters -> removed

You can add your own mappings in the hook config.

Install (as a hook consumer)

Add this repo to your .pre-commit-config.yaml:

repos:
- repo: https://github.com/wdroz/PurifyLLM
  rev: v0.1.1
  hooks:
  - id: purify-llm
    # optional: ignore folders/files via glob and add extra replacements
    exclude: '(^|/)(LICENSES|licenses)/'
  args:
  # add custom mappings
  - --map
  - "\u00AB=\""   # « to "
  - --map
  - "\u00BB=\""   # » to "

Then install hooks:

pre-commit install

Run on all files at any time:

pre-commit run --all-files

CLI usage

purifyllm [--no-defaults] [--map KEY=VALUE ...] [--ignore-files GLOB ...] [FILES ...]

Examples:

purifyllm README.md
purifyllm --map "\u00B7=-" file.txt
purifyllm --no-defaults --map "…=..." --map "—=-" src/
purifyllm --ignore-files '**/LICENSES/**' --ignore-files 'docs/vendor/**' $(git ls-files)

Exit codes:

  • 0: no changes needed
  • 1: files were modified or an error occurred

Ignoring files and folders (glob)

Use one or more --ignore-files flags to skip files by glob pattern. Matching is against the full path using forward slashes.

Examples:

  • --ignore-files '**/LICENSES/**' ignore any files under a LICENSES directory anywhere.
  • --ignore-files 'docs/vendor/**' ignore files under docs/vendor.
  • --ignore-files '*.md' ignore markdown files.

Metadata

Release files for purifyllm 0.1.2

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

Source distribution (sdist)

Source distribution for purifyllm 0.1.2
File Size Uploaded
purifyllm-0.1.2.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for purifyllm 0.1.2
File Interpreter ABI Platform
purifyllm-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.0 kB

Release files / purifyllm-0.1.2.tar.gz

Download URL purifyllm-0.1.2.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e577ec978bf65bc4b994b2d00d8c7a5c652956e1b776fd595bd4c7298124013f
BLAKE2b-256 checksum
How to use checksums
a95a7c246b159a1402c44734fced689cfe497e0b8b2e9c6f03db1c651240864c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 14, 2026.

Transparency log

Release files / purifyllm-0.1.2-py3-none-any.whl

Download URL purifyllm-0.1.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25b3fa826e2b258373df124146e43111995ddd5882da208813439b7ab899913d
BLAKE2b-256 checksum
How to use checksums
f48794b6889bbe927f599936d8ea05c767cf7e7ca299eb912409cb06decebb71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

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