Simple utility to turn swipes into words -- "plugin" for wvkbd to enable swipe-typing under wayland SXMO.
mapscore:complete script
Zach DeCook 2021-11-24
parent 8c3c7a0 · commit d7c1438
-rwxr-xr-xmapScore.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mapScore.py b/mapScore.py
index 4f69847..2385106 100755
--- a/mapScore.py
+++ b/mapScore.py
@@ -26,11 +26,15 @@ def scoreWord(word,mmap):
s+=abs(mmap[ord(pc)][1]-mmap[ord(c)][1])
pc=c
return s
-
def main(argv):
- mmap=makeMap(argv[1])
- print(scoreWord('ads',mmap))
+ mm=makeMap(argv[1])
+ while 1:
+ line = sys.stdin.readline()
+ if not line:
+ break
+ w=line.strip()
+ print(scoreWord(w,mm),w,sep='\t')
if __name__ == '__main__':
main(sys.argv)