Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ canonicalizing identifiers all break subtly when `"café"` (composed) and
`"café"` (decomposed) are treated as different strings. This library makes
them equal.

### Coming from Python

If you know Python's `unicodedata`, the normalization entry points map directly:

| Python | mojo-unicodedata |
| --------------------------------------- | ------------------------------ |
| `unicodedata.normalize("NFC", s)` | `normalize("NFC", s)` |
| `unicodedata.normalize("NFKD", s)` | `normalize("NFKD", s)` |
| `unicodedata.is_normalized("NFC", s)` | `is_normalized("NFC", s)` |
| `s.casefold()` | `casefold(s)` |

These are module-level functions. If you normalize many strings, construct a
`Normalizer()` once and call `.normalize(form, s)` / `.casefold(s)` on it to
reuse the loaded tables.

## What it handles

- **All four normalization forms**: `normalize("NFC"|"NFD"|"NFKC"|"NFKD", s)`,
Expand Down Expand Up @@ -155,9 +170,11 @@ described above.

## Part of a pure-Mojo library suite

Ten pure-Mojo libraries that mirror familiar Python stdlib and PyPI APIs,
Eleven pure-Mojo libraries that mirror familiar Python stdlib and PyPI APIs,
filling gaps in the native Mojo ecosystem:

- [mojo-xml](https://github.com/conorbronsdon/mojo-xml) — general-purpose XML
parsing, an ElementTree-shaped DOM (Python's `xml.etree.ElementTree`)
- [mojo-feed](https://github.com/conorbronsdon/mojo-feed) — RSS, Atom, and
JSON Feed parsing (Python's `feedparser`)
- [mojo-captions](https://github.com/conorbronsdon/mojo-captions) — SRT and
Expand Down
Loading