Skip to main content

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

plover_python_dictionary-0.5.8.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

plover_python_dictionary-0.5.8-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file plover_python_dictionary-0.5.8.tar.gz.

File metadata

File hashes

Hashes for plover_python_dictionary-0.5.8.tar.gz
Algorithm Hash digest
SHA256 70c19ec683c659638c9b779115d4ef2e3f3371ef5ef1342bc6aeacd6708abed7
MD5 1dd8caa3518f25791c7de13ebe4ed84c
BLAKE2b-256 4fdf2edcdc024d50acde3e15e87bcff99070ad2ecc530f286cd15bbfa97103c5

See more details on using hashes here.

File details

Details for the file plover_python_dictionary-0.5.8-py3-none-any.whl.

File metadata

File hashes

Hashes for plover_python_dictionary-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 70c6bdd3f7b824c76c14c614c4cd278e921cc52bcb14d90af5ef91ccbf3b0304
MD5 9deb43764a49b50164f6965f82034a2c
BLAKE2b-256 fd3d46af3e3c323051ee475f06b92a5a94db5e08f8f57fca8c75590dd4697bd3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page