rita — Python port of RiTa
RiTa is a library for natural language and generative writing: syllables, phonemes and stresses, parts of speech, conjugation, pluralization, stemming, letter-to-sound mapping, rhyming and alliteration, plus n-gram generation and the RiScript scripting language.
This is the Python port of RiTa, which is written in JavaScript and Java. The API mirrors the JavaScript one, so JS docs apply.
Install
pip install rita-py
Usage
from rita import RiTa
RiTa.tokenize("I'm sure he'll be interested")
# ["I'm", "sure", "he'll", "be", "interested"]
RiTa.syllables("elephant") # "eh/l-ah/f-ah-n-t"
RiTa.phones("elephant") # "eh-l-ah-f-ah-n-t"
RiTa.rhymes("cat") # ["bat", "begat", "brat", "chat", ...]
RiTa.pos("The dog ran") # ["dt", "nn", "vbd"]
# Generation
markov = RiTa.RiMarkov(2)
markov.add_text("the big dog and the big cat and the small dog")
markov.generate1() # "the big cat and the big cat and the small dog"
# RiScript
RiTa.evaluate("the [big | small] [dog | cat]") # "the small dog"
Notes
- Pure Python, no runtime dependencies. Python 3.10+.
- The canonical dictionary (
rita_dict.json) is bundled with the package. - Licensed under GPL-3.0, same as the JavaScript and Java implementations.
Development
The build is managed with uv:
uv sync # create .venv and install dev dependencies
uv run pytest -q # run the test suite
The test suite under tests/ is auto-generated from the JavaScript tests in
../js/test/ by ../scripts/js-to-py-tests.js — regenerate rather than editing
test_*.py by hand. Some tests read fixture files from ../js/test/, so keep
that checkout present when running the suite.
Metadata
Release files for rita-py 4.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rita_py-4.0.9.tar.gz | 482.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rita_py-4.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 868.7 kB
Release files / rita_py-4.0.9.tar.gz
| Download URL | rita_py-4.0.9.tar.gz |
|---|---|
| Size | 482.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65d3eae25a7dba3a1ba57aa7bb303231174647873ca0698779380e6dd3efa750
|
|
BLAKE2b-256 checksum How to use checksums |
b47a265f1f75ae8edc4a6c8c48876c55a07210e8b4bbfd4bb0c7aa2fde9966a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rita_py-4.0.9-py3-none-any.whl
| Download URL | rita_py-4.0.9-py3-none-any.whl |
|---|---|
| Size | 386.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5b3a6442cd6fc47fba4427c9c9fc9714bd5227dd817da2172353169698e4cf8
|
|
BLAKE2b-256 checksum How to use checksums |
2cd0789c6be10b50aa5a7cd09ba2876c9d4103f86e01ae5982812fe998d331c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for rita-py 4.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.