支持plover的python字典
plover-python-dictionar的Python项目详细描述
为plover添加对python字典的支持。
用法
python字典只是一个具有以下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.deflookup(key):assertlen(key)<=LONGEST_KEYraiseKeyError# Optional: return an array of stroke tuples that would translate back# to <text> (an empty array if not possible).defreverse_lookup(text):return[]
例如,将以下代码保存到show_stroke.py:
LONGEST_KEY=2SHOW_STROKE_STENO='STR*'deflookup(key):assertlen(key)<=LONGEST_KEY,'%d/%d'%(len(key),LONGEST_KEY)ifSHOW_STROKE_STENO!=key[0]:raiseKeyErroriflen(key)==1:return' 'returnkey[1]
然后把它像普通字典一样添加到字典堆栈中。
现在,如果您笔划STR*,则下一个笔划将逐字显示 (未翻译),例如-T STROEBG TP-RKW-GS STROEBG KR-GS S STR* STROEBG 输出:the stroke for "stroke" is STROEBG。
发布历史记录
0.5.10
- 修复/setup.py测试处理
- 修复反向查找的默认实现以返回列表(不是元组)
0.5.9
- 更新到Plover的最新API