ref: a0e02ac3596e4e0b0b31acc28bcfc79ed5b1e09b
parent: 7e56d77f4005978687e33578e6617aaba86df429
author: qwx <qwx@sciops.net>
date: Thu Jan 9 10:28:39 EST 2020
add pinyin input script (dictionary included: ./cin/pinyin)
--- /dev/null
+++ b/pinyin
@@ -1,0 +1,20 @@
+#!/bin/awk -f
+NR == FNR{
+ if(NF < 2)
+ exit NR ": invalid record " $0
+ for(i=2; i<=NF; i++)
+ t[$i] = t[$i] $1
+}
+NR != FNR{
+ if($1 == "")
+ next
+ for(i=1; i<=length($0)+1; i++)
+ printf "\x08"
+ if(t[$1] != ""){
+ s = t[$1]
+ if($2 ~ /^[0-9]+$/ && $2 <= length(s))
+ s = substr(s, $2, 1)
+ printf "%s", s
+ }
+ fflush
+}
--- /dev/null
+++ b/py
@@ -1,0 +1,2 @@
+#!/bin/rc
+pinyin cin/pinyin <{cat}