about summary refs log tree commit diff
path: root/swipeGuessPicker.sh
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2022-01-26 09:26:10 -0500
committerZach DeCook <zachdecook@librem.one>2022-01-26 09:26:10 -0500
commit65603837e593b5f67c74528e04b6afb7a1b77861 (patch)
tree89340192123e8683ea6fdfa534ad58e56e1ec765 /swipeGuessPicker.sh
parent52128ace9cb7dfa67811e7e6e8892efb922dc0a4 (diff)
downloadSwipeBehaviors-65603837e593b5f67c74528e04b6afb7a1b77861.tar.gz
algorithm
Diffstat (limited to 'swipeGuessPicker.sh')
-rwxr-xr-xswipeGuessPicker.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/swipeGuessPicker.sh b/swipeGuessPicker.sh
index c344052..6e233c0 100755
--- a/swipeGuessPicker.sh
+++ b/swipeGuessPicker.sh
@@ -1,11 +1,20 @@
 #!/bin/sh
 sock="$XDG_RUNTIME_DIR/sgp.sock"
 words=~/.local/share/sxmo/words.txt
+keymap=~/.local/share/sxmo/keyboard.map.tsv
 rm "$sock"
 mkfifo "$sock"
 cat 0<> "$sock"|suggpicker 2>/dev/null|completelyTypeWord.sh &
 swipeGuess "$words" 5 | while read -r word; do
 	set -- $word
+	if test "$2"; then
+		s1="$(echo "$1" | mapScore "$keymap" bee|cut -f1)"
+		s2="$(echo "$2" | mapScore "$keymap" bee |cut -f1)"
+		cutoff="$(( ($s1 * 9 / 10) - 3 ))"
+		if [ "$s2" -lt "$cutoff" ]; then
+			set -- "$1"
+		fi
+	fi
 	if test "$1" && ! test "$2"; then
 		wtype "${1:1}"
 	elif ! test "$2"; then