~earboxer/SwipeBehaviors

ref: d31a7482c3e05b87a18a23e55fb04a8c65e98ee5 SwipeBehaviors/swipeGuessPicker.sh -rwxr-xr-x 806 bytes
d31a7482Zach DeCook swipeBehaviors: cull unlikely choices with keyboard map 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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 -n "$2"; then
		s1="$(echo "$1" | mapScore "$keymap" bee|cut -f1)"
		s2="$(echo "$2" | mapScore "$keymap" bee |cut -f1)"
		cutoff="$(( ($s1 * 19 / 20) - 2 ))"
		if [ "$s2" -lt "$cutoff" ]; then
			set -- "$1"
		elif [ -n "$4" ]; then
			s4="$(echo "$4" | mapScore "$keymap" bee |cut -f1)"
			if [ "$s4" -lt "$cutoff" ]; then
				set -- "$1" "$2" "$3"
			fi
		fi
	fi
	if test "$1" && ! test "$2"; then
		wtype "${1:1}"
	elif ! test "$2"; then
		echo "" >> "$sock"
	else
		echo "$word" >> "$sock"
	fi
done

killall suggpicker