Warning: session_start(): open(/var/lib/php/sessions/sess_8j3gi6c94bk8r8ivjvml1kkfgn, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sS keyphrase = "computer";
// bigger number means more tolerance
// 1e-40 works pretty well with few false positives
// 1e-30 gets no hits
// 1e-35 doesn't trigger reliably
// Using 1e-38 for now
sS threshold = "1e-38";
sO onKeyPhrase;
sbool exited;
sS python = trim([[
#!/usr/bin/python
from subprocess import Popen, PIPE, STDOUT
import pty
import os
import sys
cmd = 'pocketsphinx_continuous -inmic yes -keyphrase #KEYPHRASE# -kws_threshold #THRESHOLD#'
master, slave = pty.openpty()
p = Popen(cmd, shell=True, stdin=PIPE, stdout=slave, stderr=slave, close_fds=True)
stdout = os.fdopen(master)
while True:
sys.stdout.write(stdout.readline())
sys.stdout.flush()
]]);
p {
unix_killAll("pocketsphinx");
onKeyPhrase = voidfunc(S s) {
infoBox("Yep!");
thread { sendOpt("Chrome Speech.", "start recognition"); }
thread { sendOpt("Kevin", "Yep"); }
};
File fPython = getProgramFile("pocketsphinx.py");
makeExecutable(saveTextFile(fPython, python.replace("#THRESHOLD#", threshold).replace("#KEYPHRASE#", bashQuote(keyphrase)));
backtickToConsole_lineBuf(f2s(fPython), voidfunc(S line) {
print("Line read: " + quote(line));
if (eq(line, keyphrase))
pcallF(onKeyPhrase, line);
else if (startsWith(line, "READY."))
consoleStatus("Ready");
else if (startsWith(line, "Listening."))
consoleStatus("Listening");
});
exited = true;
consoleStatus("Exited");
}
svoid cleanMeUp {
if (!exited) { exited = true; unix_killAll("pocketsphinx"); }
}