Metadata-Version: 2.0
Name: plover-python-dictionary
Version: 0.5.8
Summary: Python dictionaries support for Plover
Home-page: https://github.com/benoit-pierre/plover_python_dictionary
Author: Benoit Pierre
Author-email: benoit.pierre@gmail.com
License: GNU General Public License v2 or later (GPLv2+)
Keywords: plover plover_plugin
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Requires-Dist: plover (>=4.0.0.dev1)

Add support for Python dictionaries to Plover. A Python dictionary is
simply a single module with the following API:

.. code:: python

    # 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:

.. code:: python

    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``.


