{"id":16418497,"url":"https://github.com/nitely/nim-normalize","last_synced_at":"2025-04-09T16:20:31.714Z","repository":{"id":27047781,"uuid":"112156454","full_name":"nitely/nim-normalize","owner":"nitely","description":"Unicode normalization forms (tr15) in linear time","archived":false,"fork":false,"pushed_at":"2024-09-19T00:58:31.000Z","size":1134,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T18:37:27.793Z","etag":null,"topics":["nim","nim-lang","unicode","unicode-normalization"],"latest_commit_sha":null,"homepage":"https://nitely.github.io/nim-normalize/","language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nitely.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-27T06:23:41.000Z","updated_at":"2025-01-24T23:01:44.000Z","dependencies_parsed_at":"2024-06-20T10:11:25.407Z","dependency_job_id":"0d15a400-8722-4a37-95ce-240f6c13e47f","html_url":"https://github.com/nitely/nim-normalize","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitely%2Fnim-normalize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitely%2Fnim-normalize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitely%2Fnim-normalize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitely%2Fnim-normalize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nitely","download_url":"https://codeload.github.com/nitely/nim-normalize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nim","nim-lang","unicode","unicode-normalization"],"created_at":"2024-10-11T07:14:17.625Z","updated_at":"2025-04-09T16:20:31.689Z","avatar_url":"https://github.com/nitely.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Normalize\n\n[![Build Status](https://img.shields.io/travis/nitely/nim-normalize.svg?style=flat-square)](https://travis-ci.org/nitely/nim-normalize)\n[![licence](https://img.shields.io/github/license/nitely/nim-normalize.svg?style=flat-square)](https://raw.githubusercontent.com/nitely/nim-normalize/master/LICENSE)\n\nA library for normalizing unicode text. Implements all the\nUnicode Normalization Form algorithms. Normalization is\nbuffered and takes O(n) time and O(1) space.\n\n\u003e Note: the ``iterator`` version takes O(1)\n\u003e space, but the ``proc`` takes O(n) space.\n\n## Install\n\n```\nnimble install normalize\n```\n\n## Compatibility\n\nNim +1.0.0\n\n## Usage\n\n```nim\nimport normalize\n\n# Normalization\nassert toNfc(\"E◌̀\") == \"È\"\nassert toNfc(\"\\u0045\\u0300\") == \"\\u00C8\"\nassert toNfd(\"È\") == \"E◌̀\"\nassert toNfd(\"\\u00C8\") == \"\\u0045\\u0300\"\n\n# toNfkc and toNfkd are also available\n\n# Canonical comparison\nassert cmpNfd(\n  \"Voulez-vous un caf\\u00E9?\",\n  \"Voulez-vous un caf\\u0065\\u0301?\")\n\n# Normalization check (not always reliable, see docs)\nassert isNfd(toNfd(\"\\u1E0A\"))\n\n# isNfc, isNfkc and isNfkd are also available\n```\n\n\u003e Note: when printing to a terminal,\n\u003e the output may visually trick you.\n\u003e Better try printing the len or the runes\n\n[docs](https://nitely.github.io/nim-normalize/)\n\n## Optimizations\n\nThe best optimization is to avoid normalizing when the text\nis already normalized. The `isNf` family of procs can be\nused for this purpose.\n\n```nim\nimport normalize\n\ntemplate fastNfc(s: var string) =\n  if not isNfc(s):\n    s = toNfc(s)\n```\n\n\u003e Beware `isNf` may return `false` even after normalizing,\n  this is because the internal check has 3 possible outputs\n  \"Yes\", \"No\" and \"MayBe\". The problem is the output may\n  always be \"MayBe\" for certain texts.\n\n## Tests\n\n```\nnimble test\n```\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitely%2Fnim-normalize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitely%2Fnim-normalize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitely%2Fnim-normalize/lists"}