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.8.tar.gz
.
File metadata
- Download URL: plover_python_dictionary-0.5.8.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70c19ec683c659638c9b779115d4ef2e3f3371ef5ef1342bc6aeacd6708abed7 |
|
MD5 | 1dd8caa3518f25791c7de13ebe4ed84c |
|
BLAKE2b-256 | 4fdf2edcdc024d50acde3e15e87bcff99070ad2ecc530f286cd15bbfa97103c5 |
File details
Details for the file plover_python_dictionary-0.5.8-py3-none-any.whl
.
File metadata
- Download URL: plover_python_dictionary-0.5.8-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70c6bdd3f7b824c76c14c614c4cd278e921cc52bcb14d90af5ef91ccbf3b0304 |
|
MD5 | 9deb43764a49b50164f6965f82034a2c |
|
BLAKE2b-256 | fd3d46af3e3c323051ee475f06b92a5a94db5e08f8f57fca8c75590dd4697bd3 |