summaryrefslogtreecommitdiff
path: root/examples/speech/en-random_more.lali
diff options
context:
space:
mode:
Diffstat (limited to 'examples/speech/en-random_more.lali')
-rwxr-xr-xexamples/speech/en-random_more.lali129
1 files changed, 129 insertions, 0 deletions
diff --git a/examples/speech/en-random_more.lali b/examples/speech/en-random_more.lali
new file mode 100755
index 0000000..01a3cf8
--- /dev/null
+++ b/examples/speech/en-random_more.lali
@@ -0,0 +1,129 @@
+;; Execute this script an say the proper combo found in the elements
+;; of the words variable.
+;;
+;; A say may be the following examples (one example per line):
+;; yes more
+;; no no no
+;; yes
+;; (etc., too many combos to put all here).
+
+(set '_ '_)
+
+(set 'words '((yes +2)
+ (more +1)
+ (okay +0)
+ (less -1)
+ (no -2)))
+
+(set 'answer '((+8 "everything" +3) ;; all of this + maybe other (group)
+ (+7 "muchthing" +2) ;; all of this + maybe one of other / another
+ (+6 "every" +1) ;; all of this
+ (+5 "much" +0) ;; more of this
+ (+4 "some" _) ;; this
+ (+3 "few" -0) ;; few of this
+ (+2 "not" -1) ;; not this + maybe other (group)
+ (+1 "fewthing" -2) ;; not this + maybe one of other / another
+ (+0 "notthing" -3))) ;; nothing
+
+(set 'question '((+8 "everything" +3)
+ (+7 "muchthing" +2)
+ (+6 "every" +1)
+ (+5 "much" +0)
+ (+4 "some" _)
+ (+3 "few" -0)
+ (+2 "not" -1)
+ (+1 "fewthing" -2)
+ (+0 "notthing" -3)))
+
+(defun assoc (el lst)
+ (fill
+ ((dif el (car (car lst))) (car lst))
+ ((ap lst) '(f f))
+ (f (assoc el (cdr lst)))))
+
+(defun without (el lst)
+ (fill
+ ((dif el (car lst)) f)
+ ((ap (car lst)) t)
+ (f (without el (cdr lst)))))
+
+;; vv begin of training options vv
+
+(defun train-ups-and-downs ()
+ (random +8))
+
+(defun train-ups ()
+ (+ +4 (random +4)))
+
+(defun train-downs ()
+ (random +4))
+
+(defun train-middle ()
+ (+ +2 (random +4)))
+
+(defun train-inner ()
+ (+ +3 (random +2)))
+
+(defun train-without-high ()
+ (random +6))
+
+(defun train-without-low ()
+ (+ +2 (random +6)))
+
+;; ^^ end of training options ^^
+
+(defun get-answer-score (the-words)
+ (fill
+ ((without f the-words)
+ (prog
+ (princ "\n~\n>> unrecognized answer")
+ (newline)
+ f))
+ (f (eval (cons + the-words)))))
+
+(defun main ()
+ (progs
+ f
+ ;; vv change training (just) here (below) vv
+ (set 'target-question (train-ups-and-downs))
+ (set 'it-quest (assoc target-question question))
+ (princ (car (cdr it-quest)))
+ (princ "\b?\n")
+ (newline)
+
+ ;; vv change training (just) here (below) vv
+ (set 'target-answer (train-middle))
+ (princ "answer ->")
+ (princ (car (cdr (assoc target-answer answer))))
+ (princ ".")
+
+ (newline)
+ (princ "say:")
+
+ (set 'question-score target-question)
+ (set 'my-words (readl))
+ (differ my-words '(f))
+ (set 'answer-score (get-answer-score
+ (map
+ (lambda (word)
+ (car (cdr (assoc word words))))
+ my-words)))
+ (princ "\n~")
+ (newline)
+ (fill
+ ((dif target-answer
+ (+ question-score answer-score))
+ 'correct)
+ (f 'wrong))))
+
+(defun loop ()
+ (set 'res (main))
+ (fill
+ ((dif res 'correct) (loop))
+ ((dif res 'wrong) (prog (princ ">> wrong") (newline)))
+ (f f)))
+
+
+(princ "Reply to the question, according to the answer.\nSay a combination (one or more) of the following words:\nyes, more, okay, less, no.\n\nAnother question will appear, if you say correctly.\nYou may say f to quit training.\n-~-\n")
+(newline)
+(loop)