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_dev3

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_dev3
File
rtfcre-2.0.0_dev3-cp39-none-win_amd64.whl CPython 3.9 none Windows x86-64 Details
rtfcre-2.0.0_dev3-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_dev3-cp39-cp39-macosx_10_7_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.7+ x86-64 Details
rtfcre-2.0.0_dev3-cp38-none-win_amd64.whl CPython 3.8 none Windows x86-64 Details
rtfcre-2.0.0_dev3-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_dev3-cp38-cp38-macosx_10_7_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.7+ x86-64 Details
rtfcre-2.0.0_dev3-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details
rtfcre-2.0.0_dev3-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_dev3-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_dev3-cp36-none-win_amd64.whl CPython 3.6 none Windows x86-64 Details
rtfcre-2.0.0_dev3-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_dev3-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details

Total release size: 11.1 MB

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

Download URL rtfcre-2.0.0_dev3-cp39-none-win_amd64.whl
Size 586.8 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
03239d19fbf680f79e3e81f39976bb89d70dd10bbc33e645d7eb39a058594552
BLAKE2b-256 checksum
How to use checksums
4ec0b5b71a3db04c5d5f004fa5af0d958e17d5ffd08dc3c4e42d4a363f8009a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp39-cp39-manylinux_2_24_x86_64.whl
Size 1.5 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
a83de2d8bb2eedefbed32d164b90e183b9a90df9f242735e0b6475ad42ed3011
BLAKE2b-256 checksum
How to use checksums
1620ca73e1440e753766f6ce7e6d31d744b40ba416542a76077be32c56d62a93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp39-cp39-macosx_10_7_x86_64.whl
Size 727.2 kB
Tags CPython 3.9 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
a25e652cbabc46c20fd2e57a40018fe2c6f3460d7da99f9fac37c04c5231ba60
BLAKE2b-256 checksum
How to use checksums
98346d550f073bb94cc51d0b4bd4e49ca891cc116c754530737a97d8eba06453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp38-none-win_amd64.whl
Size 586.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
5cf7837bfdbffeab02865a431b40ab8e77f52bc0430be4a7d01012d77e453275
BLAKE2b-256 checksum
How to use checksums
356d8fd36c93fdd5892ebc158d818a867b17a92dad4d431916bb606183855950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp38-cp38-manylinux_2_24_x86_64.whl
Size 1.5 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
ca2c8076dd0cd57691ca5ab38bfaee09f31c4427a3411e866d3808d840b3d63c
BLAKE2b-256 checksum
How to use checksums
ffe7161578c79f298d0e8bb6fa0524ef3a4b0e7f3772cb70ebe85fd38ad51639
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp38-cp38-macosx_10_7_x86_64.whl
Size 727.2 kB
Tags CPython 3.8 macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
9dd776e4f86f4dc7a053a1c3549f897068eea294cfe29e7501cd3a7a4f78787b
BLAKE2b-256 checksum
How to use checksums
7c39528db9b04a2b53afd61010de6e92d461a215bfbd495c96b17d9e1d10e55e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp37-none-win_amd64.whl
Size 586.8 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
f91c8b257798c2918a39ea635f0e7935c0c45ace508302b155c8f5d838e0bba8
BLAKE2b-256 checksum
How to use checksums
a4db35cafc87203c82a84e1660c878751dce95481833d74004e1a741a8d218bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp37-cp37m-manylinux_2_24_x86_64.whl
Size 1.5 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
e18752772a07ac8233b1d93903a5804477e4cbbf1f32ed6e26d59764cc90a736
BLAKE2b-256 checksum
How to use checksums
2baef27f2c28096e7aea02312decce7bde1ce237b6053c4ca65ee2b9caeb87eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp37-cp37m-macosx_10_7_x86_64.whl
Size 727.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
37f2d14273d3a23ae1deadb40a07266321e70adb7b89eb8e7f66b1743d490059
BLAKE2b-256 checksum
How to use checksums
fd59f2281af94abd4c14203592d8fef049d864caafe381046d15ded461281e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp36-none-win_amd64.whl
Size 587.1 kB
Tags CPython 3.6 Windows x86-64
SHA-256 checksum
How to use checksums
a5b2a62e6e5a03477a0e2466d314442e34a383fcfc69051c6c166283f0803062
BLAKE2b-256 checksum
How to use checksums
c3939c289557010d3ea862c2ccc6e4dc7f00355f877cda29b8a7e5928e124672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp36-cp36m-manylinux_2_24_x86_64.whl
Size 1.5 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
63a59df7490242cff538449a8c05fd8bf246820c6374ffc056d64d419ae8e61f
BLAKE2b-256 checksum
How to use checksums
fa8bf63a521ded1d59d6733a55a415ea94ddc746935f5f25d60dd1699ff8a32c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

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

Download URL rtfcre-2.0.0_dev3-cp36-cp36m-macosx_10_7_x86_64.whl
Size 727.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
4643b50e6a63aa15aa40fc2f6ce63058fffb114e21366835b6c35ffdeafe0e4c
BLAKE2b-256 checksum
How to use checksums
760c431d031826d39674ae28c12ab0902dec073579b05aecd43c573f4efcdc2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
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