{"id":14964417,"url":"https://github.com/sammdot/rtfcre","last_synced_at":"2025-10-25T07:30:45.286Z","repository":{"id":57463112,"uuid":"325688047","full_name":"sammdot/rtfcre","owner":"sammdot","description":"Python library for Rich Text Format with Court Reporting Extensions (RTF/CRE) dictionaries","archived":false,"fork":false,"pushed_at":"2021-10-17T22:29:48.000Z","size":190,"stargazers_count":13,"open_issues_count":8,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-09-30T02:34:01.432Z","etag":null,"topics":["dictionaries","dictionary","plover","rtf","steno","stenography"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sammdot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-31T01:48:30.000Z","updated_at":"2024-05-24T21:40:08.000Z","dependencies_parsed_at":"2022-09-12T13:22:29.676Z","dependency_job_id":null,"html_url":"https://github.com/sammdot/rtfcre","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/sammdot%2Frtfcre","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammdot%2Frtfcre/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammdot%2Frtfcre/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sammdot%2Frtfcre/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sammdot","download_url":"https://codeload.github.com/sammdot/rtfcre/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219866300,"owners_count":16555905,"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":["dictionaries","dictionary","plover","rtf","steno","stenography"],"created_at":"2024-09-24T13:33:09.060Z","updated_at":"2025-10-25T07:30:44.972Z","avatar_url":"https://github.com/sammdot.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rtfcre\n\n[![pypi](https://img.shields.io/pypi/v/rtfcre)](https://pypi.org/project/rtfcre)\n![python](https://img.shields.io/pypi/pyversions/rtfcre)\n![tests](https://github.com/sammdot/rtfcre/workflows/tests/badge.svg)\n\n`rtfcre` is a Python library for reading and writing steno dictionaries in the\n[RTF/CRE](http://www.legalxml.org/workgroups/substantive/transcripts/cre-spec.htm)\n(Rich Text Format with Court Reporting Extensions) format. The library provides\nan API similar to that of the `json` module for reading and writing dictionaries.\n\n`rtfcre` also comes with a little command-line utility that you can use to\nconvert your dictionaries between Plover's native JSON format and RTF. See\n[CLI](#cli) for more information.\n\n## Features\n\n* **Speed**: The parsing logic is written in Rust using parser combinators,\n  making it much faster than practically any pure-Python implementation.\n\n* **Comments**: Rather than just exposing translations, `rtfcre` also reads the\n  comments embedded in each entry (`{\\*\\cxcomment like this}`).\n\n* **Unicode**: Full Unicode support -- while the dictionary files are not\n  encoded in UTF-8, Unicode characters in translations are still fully\n  supported. Translations can be in any language and they will seamlessly be\n  converted to escapes when writing.\n\n* **Plover support**: Translations are converted automatically to Plover's\n  native syntax (e.g. fingerspelling is represented with `{\u0026a}` rather than\n  `{\\cxfing a}`) and converted back when writing.\n\n## Installation\n\nTo install the library:\n\n```\npip install rtfcre\n```\n\nIf you just want to use this with Plover, install the\n[plover-better-rtf](https://github.com/sammdot/plover-better-rtf) plugin\ninstead, since that plugin uses this library under the hood.\n\nIf you want the command-line utility, go to the\n[Releases](https://github.com/sammdot/rtfcre/releases) page and download the\nbinary for your system.\n\n## Usage\n\n### Library\n\nTo read an RTF dictionary:\n\n```python\nimport rtfcre\n\n# Reading directly from a file (make sure to open binary)\nwith open(\"dict.rtf\", \"rb\") as file:\n  dic = rtfcre.load(file)\n\n# Reading from a string\nrtf = r\"\"\"\n{\\rtf1\\ansi{\\*\\cxrev100}\\cxdict{\\*\\cxsystem KittyCAT}\n{\\*\\cxs KAT}cat\n{\\*\\cxs KOU}cow\n}\n\"\"\".lstrip()\ndic = rtfcre.loads(rtf)\n```\n\nTo write the RTF dictionary:\n\n```python\n# Writing to a file (make sure to open binary)\nwith open(\"dict.rtf\", \"wb\") as file:\n  dic.dump(file)\n\n# Writing to a string\nrtf = dic.dumps()\n```\n\nThe dictionary object itself also supports the standard `dict` API:\n\n```python\ndic[\"KAT\"] = \"cat\"\n\n\"KAT\" in dic  # True\ndic[\"KAT\"]  # \"cat\"\n\ndel dic[\"KAT\"]\n\ndic[\"TKOG\"]  # KeyError\ndic[\"TKOG\"] = \"dog\"\ndic[\"TKOG\"]  # \"dog\"\n```\n\nas well as a reverse lookup API for mapping from translations to steno strokes:\n\n```python\ndic.reverse_lookup(\"cat\")  # [\"KAT\"]\n```\n\nTo access comments:\n\n```python\ndic.lookup(\"TKOG\")  # (\"dog\", None)\n\ndic.add_comment(\"TKOG\", \"TK means D\")\ndic.lookup(\"TKOG\")  # (\"dog\", \"TK means D\")\n\ndic.remove_comment(\"TKOG\")\n```\n\n### CLI\n\nTo convert an existing Plover JSON dictionary to RTF:\n\n```\nrtfcre path/to/input.json path/to/output.rtf\n```\n\nTo convert an existing RTF dictionary back to Plover JSON:\n\n```\nrtfcre path/to/input.rtf path/to/output.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsammdot%2Frtfcre","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsammdot%2Frtfcre","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsammdot%2Frtfcre/lists"}