Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rtfcre

pypi python tests

rtfcre is a Python library for reading and writing steno dictionaries in the RTF/CRE (Rich Text Format with Court Reporting Extensions) format. The library provides an API similar to that of the json module for reading and writing dictionaries.

rtfcre also comes with a little command-line utility that you can use to convert your dictionaries between Plover's native JSON format and RTF. See CLI for more information.

Features

  • Speed: The parsing logic is written in Rust using parser combinators, making it much faster than practically any pure-Python implementation.

  • Comments: Rather than just exposing translations, rtfcre also reads the comments embedded in each entry ({\*\cxcomment like this}).

  • Unicode: Full Unicode support -- while the dictionary files are not encoded in UTF-8, Unicode characters in translations are still fully supported. Translations can be in any language and they will seamlessly be converted to escapes when writing.

  • Plover support: Translations are converted automatically to Plover's native syntax (e.g. fingerspelling is represented with {&a} rather than {\cxfing a}) and converted back when writing.

Installation

To install the library:

pip install rtfcre

If you just want to use this with Plover, install the plover-better-rtf plugin instead, since that plugin uses this library under the hood.

If you want the command-line utility, go to the Releases page and download the binary for your system.

Usage

Library

To read an RTF dictionary:

import rtfcre

# Reading directly from a file (make sure to open binary)
with open("dict.rtf", "rb") as file:
  dic = rtfcre.load(file)

# Reading from a string
rtf = r"""
{\rtf1\ansi{\*\cxrev100}\cxdict{\*\cxsystem KittyCAT}
{\*\cxs KAT}cat
{\*\cxs KOU}cow
}
""".lstrip()
dic = rtfcre.loads(rtf)

To write the RTF dictionary:

# Writing to a file (make sure to open binary)
with open("dict.rtf", "wb") as file:
  dic.dump(file)

# Writing to a string
rtf = dic.dumps()

The dictionary object itself also supports the standard dict API:

dic["KAT"] = "cat"

"KAT" in dic  # True
dic["KAT"]  # "cat"

del dic["KAT"]

dic["TKOG"]  # KeyError
dic["TKOG"] = "dog"
dic["TKOG"]  # "dog"

as well as a reverse lookup API for mapping from translations to steno strokes:

dic.reverse_lookup("cat")  # ["KAT"]

To access comments:

dic.lookup("TKOG")  # ("dog", None)

dic.add_comment("TKOG", "TK means D")
dic.lookup("TKOG")  # ("dog", "TK means D")

dic.remove_comment("TKOG")

CLI

To convert an existing Plover JSON dictionary to RTF:

rtfcre path/to/input.json path/to/output.rtf

To convert an existing RTF dictionary back to Plover JSON:

rtfcre path/to/input.rtf path/to/output.json

Metadata

Release files for rtfcre 2.0.0_dev4

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

Built distributions (wheels)

Table of built distributions (wheels) for rtfcre 2.0.0_dev4
File
rtfcre-2.0.0_dev4-cp39-none-win_amd64.whl CPython 3.9 none Windows x86-64 Details
rtfcre-2.0.0_dev4-cp39-cp39-manylinux_2_24_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-64 Details
rtfcre-2.0.0_dev4-cp39-cp39-macosx_10_7_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.7+ x86-64 Details
rtfcre-2.0.0_dev4-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details
rtfcre-2.0.0_dev4-cp38-cp38-manylinux_2_24_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-64 Details
rtfcre-2.0.0_dev4-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details
rtfcre-2.0.0_dev4-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details
rtfcre-2.0.0_dev4-cp37-cp37m-manylinux_2_24_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64 Details
rtfcre-2.0.0_dev4-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details
rtfcre-2.0.0_dev4-cp36-none-win_amd64.whl CPython 3.6 none Windows x86-64 Details
rtfcre-2.0.0_dev4-cp36-cp36m-manylinux_2_24_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64 Details
rtfcre-2.0.0_dev4-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details

Total release size: 10.9 MB

Release files / rtfcre-2.0.0_dev4-cp39-none-win_amd64.whl

Download URL rtfcre-2.0.0_dev4-cp39-none-win_amd64.whl
Size 569.7 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
10d2d7e01cde593b3243bc61796a4e538710a94cdee015057a4c9f5fd304d133
BLAKE2b-256 checksum
How to use checksums
1fa056eaf758e0390c6940cb66ed95b6c818ff60a38ac3ad1335c63115850dc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp39-cp39-manylinux_2_24_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp39-cp39-manylinux_2_24_x86_64.whl
Size 1.4 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
7acbae45a8a8f1adcd9a8520308232542a22d0161f45f8cdb117b4f3d92a8999
BLAKE2b-256 checksum
How to use checksums
f84bf86b617f37a2827ddbef994d0441d5885c9a34845559410bcac4c533b599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp39-cp39-macosx_10_7_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp39-cp39-macosx_10_7_x86_64.whl
Size 706.8 kB
Tags CPython 3.9 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
96b2f56f5bb0026169a83d9e9afef749c0ba06f9bb32adeaf16729c5a810e453
BLAKE2b-256 checksum
How to use checksums
2124d6da82ca1efd00fe7da2fdda3f0082e461d98eed4c5a168e965e9a6e1801
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp38-none-win_amd64.whl

Download URL rtfcre-2.0.0_dev4-cp38-none-win_amd64.whl
Size 569.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
d23cbb5cad3a9f720d43425ba4807b2093e76ec9486e9f37620fe7a4481f1a46
BLAKE2b-256 checksum
How to use checksums
cb08d37804a66db4a84c3e4daae8cda9a5a4fb21104f41a5c6fd546c221175a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp38-cp38-manylinux_2_24_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp38-cp38-manylinux_2_24_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
232bfdf09922bf3782dc69c458cd0966288917e225ad20583569a6d3818c86f4
BLAKE2b-256 checksum
How to use checksums
c56d2fae889addebc95cca74e9e84a8d615170d3286670dab2660e17e7593991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp38-cp38-macosx_10_7_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp38-cp38-macosx_10_7_x86_64.whl
Size 706.8 kB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
158037003ec6b76c56d3c128bc59e393437a16e742948b6146f1ed1772862274
BLAKE2b-256 checksum
How to use checksums
6811681a0a7485eb3a54fca36f13441b5963f923669c1b65208a1d1cbde3ed19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp37-none-win_amd64.whl

Download URL rtfcre-2.0.0_dev4-cp37-none-win_amd64.whl
Size 569.7 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
498dcbe76502e956ca7e9a5ec2f5f42692ff2f1b7f9fb459f58270cbe407d5c3
BLAKE2b-256 checksum
How to use checksums
bdec956bf89b4debf44ed1db6bfcf937f655653e487607622dd1a4946e617ffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp37-cp37m-manylinux_2_24_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp37-cp37m-manylinux_2_24_x86_64.whl
Size 1.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
8f9ec94396a9baadaabd80bef4ed0729fe8f6a0ac740a7ce6081211adb9ccce0
BLAKE2b-256 checksum
How to use checksums
6b8e748cc2b013c48cf254e7daa887a6e70ee53396ea097042278c1e7e127404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp37-cp37m-macosx_10_7_x86_64.whl
Size 706.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
45aeb02472ab56273daf6227c8d11c3455e8b4fa51b142613f9aa34b9837785a
BLAKE2b-256 checksum
How to use checksums
3c5362f73ae4b6a58e85e1704595388e579e3a3af1643650408ca0a59666065e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp36-none-win_amd64.whl

Download URL rtfcre-2.0.0_dev4-cp36-none-win_amd64.whl
Size 570.2 kB
Tags CPython 3.6 Windows x86-64
SHA-256 checksum
How to use checksums
a24306db89b75dbad187bf0394190e17291daa3d76433f6cdc2e91800fb6d339
BLAKE2b-256 checksum
How to use checksums
dbe0f2ffcba6b96f914e1f63c7bb098c4e137176c69e282c4da9a1cad17dd75b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp36-cp36m-manylinux_2_24_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp36-cp36m-manylinux_2_24_x86_64.whl
Size 1.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
e3a84b9c13542847a154b1e7a77b7dd26781ad05158eb8efe83da1e1446808fe
BLAKE2b-256 checksum
How to use checksums
7852334edb5d99142b4c77c892d33eb7fd49ed775145edf7f3c46be696379b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

Release files / rtfcre-2.0.0_dev4-cp36-cp36m-macosx_10_7_x86_64.whl

Download URL rtfcre-2.0.0_dev4-cp36-cp36m-macosx_10_7_x86_64.whl
Size 706.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
fdfdd2feb62f942ef4aaf087cd41d15bf36b982a19e423b82a98f5d38fb4ce27
BLAKE2b-256 checksum
How to use checksums
d5cccefd3a393c2a85a824a52fe7f41bf948f72796c8c8e28f5eb8c482271a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
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