summaryrefslogtreecommitdiff
path: root/examples/speech
diff options
context:
space:
mode:
Diffstat (limited to 'examples/speech')
-rwxr-xr-xexamples/speech/en-random.lali103
-rwxr-xr-xexamples/speech/en-random_more.lali129
-rwxr-xr-xexamples/speech/pt-fixed_answer.lali94
-rwxr-xr-xexamples/speech/pt-identify.lali47
-rwxr-xr-xexamples/speech/pt-random.lali107
-rwxr-xr-xexamples/speech/pt-random_more.lali129
6 files changed, 609 insertions, 0 deletions
diff --git a/examples/speech/en-random.lali b/examples/speech/en-random.lali
new file mode 100755
index 0000000..6c2d0a6
--- /dev/null
+++ b/examples/speech/en-random.lali
@@ -0,0 +1,103 @@
+;; 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):
+;; okay
+;; no no
+;; yes
+;; (etc., there are more combos).
+
+(set '_ '_)
+
+(set 'words '((yes +1)
+ (okay +0)
+ (no -1)))
+
+(set 'answer '((+2 "positival / wanting" +1)
+ (+1 "neutral / be" _)
+ (+0 "negatival / awaying" -1)))
+
+(set 'question '((+2 "do irie" +1)
+ (+1 "do" _)
+ (+0 "do not" -1)))
+
+(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 +2))
+
+(defun train-ups ()
+ (+ +1 (random +1)))
+
+(defun train-downs ()
+ (random +1))
+
+;; ^^ 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-ups-and-downs))
+ (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, okay, no.\n\nAnother question will appear, if you say correctly.\nYou may say f to quit training.\n-~-\n")
+(newline)
+(loop)
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)
diff --git a/examples/speech/pt-fixed_answer.lali b/examples/speech/pt-fixed_answer.lali
new file mode 100755
index 0000000..a50820d
--- /dev/null
+++ b/examples/speech/pt-fixed_answer.lali
@@ -0,0 +1,94 @@
+(set '_ '_)
+
+(set 'reply '((sim +2)
+ (mais +1)
+ (okay +0)
+ (menos -1)
+ (nao -2)))
+
+(set 'question '((+8 "sim todo" +3) ;; todo este + talvez outro grupo
+ (+7 "sim muito" +2) ;; todo este + talvez um de outro
+ (+6 "todo" +1) ;; todo deste
+ (+5 "muito" +0) ;; muito deste
+ (+4 "algo" _) ;; assim
+ (+3 "pouco" -0) ;; pouco deste
+ (+2 "nao (outro)" -1) ;; nada deste + talvez outro grupo
+ (+1 "nao (outro) pouco" -2) ;; nada deste + talvez um de outro
+ (+0 "nada" -3))) ;; nenhum
+
+(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)))
+
+;; ^^ end of training options ^^
+
+(defun get-answer-score (the-reply)
+ (fill
+ ((without f the-reply)
+ (prog
+ (princ "\n~\n>> desconheço")
+ (newline)
+ f))
+ (f (eval (cons + the-reply)))))
+
+(defun main ()
+ (progs
+ f
+ ;; vv change training (just) below here vv
+ (set 'target-question (train-ups-and-downs))
+ (set 'it-quest (assoc target-question question))
+ (princ (car (cdr it-quest)))
+ (princ "\b?")
+ (newline)
+ (newline)
+
+ (set 'target-answer +4)
+ (princ "resposta:")
+
+ (set 'question-score target-question)
+ (set 'my-reply (readl))
+ (differ my-reply '(f))
+ (set 'answer-score (get-answer-score
+ (map
+ (lambda (word)
+ (car (cdr (assoc word reply))))
+ my-reply)))
+ (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 ">> errado") (newline)))
+ (f f)))
+
+(loop)
diff --git a/examples/speech/pt-identify.lali b/examples/speech/pt-identify.lali
new file mode 100755
index 0000000..aac6416
--- /dev/null
+++ b/examples/speech/pt-identify.lali
@@ -0,0 +1,47 @@
+(set '_ '_)
+
+(set 'question '((+8 "sim todo" +3)
+ (+7 "sim muito" +2)
+ (+6 "todo" +1)
+ (+5 "muito" +0)
+ (+4 "algo" _)
+ (+3 "pouco" -0)
+ (+2 "nao (outro)" -1)
+ (+1 "nao (outro) pouco" -2)
+ (+0 "nada" -3)))
+
+(defun assoc (number lst)
+ (fill
+ ((dif number (car (car lst))) (car lst))
+ ((ap lst) f)
+ (f (assoc number (cdr lst)))))
+
+(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 main ()
+ (progs
+ f
+ (set 'target-question (train-ups-and-downs))
+ (set 'it-quest (assoc target-question question))
+ (princ (car (cdr it-quest)))
+ (princ "\b?")
+ (not (dif (read) (car (cdr (cdr it-quest)))))))
+
+(defun loop ()
+ (fill
+ ((main) (prog
+ (princ ">> errado")
+ (newline)))
+ (f (loop))))
+
+(loop)
diff --git a/examples/speech/pt-random.lali b/examples/speech/pt-random.lali
new file mode 100755
index 0000000..6ff31fb
--- /dev/null
+++ b/examples/speech/pt-random.lali
@@ -0,0 +1,107 @@
+;; Executa este script e diz uma combinação dos elementos da variável
+;; words.
+;;
+;; Alguns exemplos que podes dizer (um exemplo por linha):
+;; okay
+;; nao nao
+;; sim
+;; (etc., existem mais combinações).
+
+(set '_ '_)
+
+(set 'words '((sim +1)
+ (okay +0)
+ (nao -1)))
+
+(set 'answer '((+2 "positival / querer" +0)
+ (+1 "neutral / ser" _)
+ (+0 "negatival / forar" -0)))
+
+(set 'question '((+2 "sim / queres <verbo>" +0)
+ (+1 "<verbo>" _)
+ (+0 "não <verbo>" -0)
+ (-1 "<negação do vazio>" -1)))
+
+(defun assoc (el lst)
+ (fill
+ ((dif el (car (car lst))) (car lst))
+ ((ap lst) '(f 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-all-questions ()
+ (- (random +3) +1))
+
+(defun train-negative-concord-questions ()
+ -1)
+
+(defun train-good-questions ()
+ (random +2))
+
+(defun train-all-answers ()
+ (random +2))
+
+;; ^^ end of training options ^^
+
+(defun get-answer-score (the-words)
+ (fill
+ ((without f the-words)
+ (prog
+ (princ "\n~\n>> desconheço")
+ (newline)
+ f))
+ (f (eval (cons + the-words)))))
+
+(defun main ()
+ (progs
+ f
+ ;; vv change training (just) here (below) vv
+ (set 'target-question (train-all-questions))
+ (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-all-answers))
+ (princ "resposta ->")
+ (princ (car (cdr (assoc target-answer answer))))
+ (princ ".")
+
+ (newline)
+ (princ "dizer:")
+
+ (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 ">> errado") (newline)))
+ (f f)))
+
+
+(princ "Perante a pergunta, dizer de acordo com a resposta.\nDizer uma combinação (de uma ou mais) das seguintes palavras:\nsim, okay, nao.\n\nSe acertares, aparecerá outra pergunta.\nPodes dizer f para sair deste treino.\n-~-\n")
+(newline)
+(loop)
diff --git a/examples/speech/pt-random_more.lali b/examples/speech/pt-random_more.lali
new file mode 100755
index 0000000..37155e1
--- /dev/null
+++ b/examples/speech/pt-random_more.lali
@@ -0,0 +1,129 @@
+;; Executa este script e diz uma combinação dos elementos da variável
+;; words.
+;;
+;; Alguns exemplos que podes dizer (um exemplo por linha):
+;; sim mais
+;; nao nao nao
+;; sim
+;; (etc., existem demasiadas combinações para pô-las todas aqui).
+
+(set '_ '_)
+
+(set 'words '((sim +2)
+ (mais +1)
+ (okay +0)
+ (menos -1)
+ (nao -2)))
+
+(set 'answer '((+8 "sim todo" +3) ;; todo deste + talvez outro grupo
+ (+7 "sim muito" +2) ;; todo deste + talvez um de outro
+ (+6 "todo" +1) ;; todo deste
+ (+5 "muito" +0) ;; muito deste
+ (+4 "algo" _) ;; assim
+ (+3 "pouco" -0) ;; pouco deste
+ (+2 "nada" -1) ;; nada deste + talvez outro grupo
+ (+1 "nao pouco" -2) ;; nada deste + talvez um de outro
+ (+0 "nao nada" -3))) ;; nenhum
+
+(set 'question '((+8 "sim todo" +3)
+ (+7 "sim muito" +2)
+ (+6 "todo" +1)
+ (+5 "muito" +0)
+ (+4 "algo" _)
+ (+3 "pouco" -0)
+ (+2 "nada" -1)
+ (+1 "nao pouco" -2)
+ (+0 "nao nada" -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>> desconheço")
+ (newline)
+ f))
+ (f (eval (cons + the-words)))))
+
+(defun main ()
+ (progs
+ f
+ ;; vv change training (just) here (below) vv
+ (set 'target-question (train-without-high))
+ (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-ups-and-downs))
+ (princ "resposta ->")
+ (princ (car (cdr (assoc target-answer answer))))
+ (princ ".")
+
+ (newline)
+ (princ "dizer:")
+
+ (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 ">> errado") (newline)))
+ (f f)))
+
+
+(princ "Perante a pergunta, dizer de acordo com a resposta.\nDizer uma combinação (de uma ou mais) das seguintes palavras:\nsim, mais, okay, menos, nao.\n\nSe acertares, aparecerá outra pergunta.\nPodes dizer f para sair deste treino.\n-~-\n")
+(newline)
+(loop)