Python dictionaries support for Plover
Project description
Add support for Python dictionaries to Plover. A Python dictionary is simply a single module with the following API:
# Length of the longest supported key (number of strokes).
LONGEST_KEY = 1
# Lookup function: return the translation for <key> (a tuple of strokes)
# or raise KeyError if no translation is available/possible.
def lookup(key):
assert len(key) <= LONGEST_KEY
raise KeyError
# Optional: return an array of stroke tuples that would translate back
# to <text> (an empty array if not possible).
def reverse_lookup(text):
return []
For example with the following dictionary:
LONGEST_KEY = 2
SHOW_STROKE_STENO = 'STR*'
def lookup(key):
assert len(key) <= LONGEST_KEY, '%d/%d' % (len(key), LONGEST_KEY)
if SHOW_STROKE_STENO != key[0]:
raise KeyError
if len(key) == 1:
return ' '
return key[1]
If you stroke STR*, then the next stroke will be shown verbatim (untranslated), e.g. -T STROEBG TP-R KW-GS STROEBG KR-GS S STR* STROEBG outputs: the stroke for "stroke" is STROEBG.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plover_python_dictionary-0.5.9.tar.gz
.
File metadata
- Download URL: plover_python_dictionary-0.5.9.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8660c1a1c31e6bd0b1b96263ac034a71c62d95d3755d59ef8fe0670af23b6911 |
|
MD5 | bc24ea32d4797f7cc9bf3c7c8726e50f |
|
BLAKE2b-256 | 1a5860d816bc782af9f51a5cb8e5571ef4eafb59d65b4134f0aa79a3f17a148f |
File details
Details for the file plover_python_dictionary-0.5.9-py3-none-any.whl
.
File metadata
- Download URL: plover_python_dictionary-0.5.9-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbd1340bdf2da37d1f438e4babe0bc605e9662804e11389874ddde06535bbcdd |
|
MD5 | d4c77a02aed3f59fef0c574deb48a384 |
|
BLAKE2b-256 | 3a69fba896f6549b4c8e181d68e521c9f9bccc4f6234513560bd25d073fedfea |