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.9.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

plover_python_dictionary-0.5.9-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for plover_python_dictionary-0.5.9.tar.gz
Algorithm Hash digest
SHA256 8660c1a1c31e6bd0b1b96263ac034a71c62d95d3755d59ef8fe0670af23b6911
MD5 bc24ea32d4797f7cc9bf3c7c8726e50f
BLAKE2b-256 1a5860d816bc782af9f51a5cb8e5571ef4eafb59d65b4134f0aa79a3f17a148f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for plover_python_dictionary-0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 fbd1340bdf2da37d1f438e4babe0bc605e9662804e11389874ddde06535bbcdd
MD5 d4c77a02aed3f59fef0c574deb48a384
BLAKE2b-256 3a69fba896f6549b4c8e181d68e521c9f9bccc4f6234513560bd25d073fedfea

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