forked from Mirrors/freeswitch
tweaks to speech tools to score differently for pocketsphinx
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9003 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
060d86c029
commit
ebb35b5d97
@ -181,6 +181,22 @@ function SpeechDetect(session, mod, ip) {
|
||||
console_log("debug", "----Hit score " + interp.@score + "/" + grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");
|
||||
}
|
||||
|
||||
if (this.mod == "pocketsphinx") {
|
||||
/* pocketsphinx scores 0 best to 100 worst. */
|
||||
if (interp.@score >= grammar_object.min_score) {
|
||||
if (interp.@score >= grammar_object.confirm_score) {
|
||||
rv.push("_confirm_");
|
||||
}
|
||||
|
||||
eval("xo = interp." + grammar_object.obj_path + ";");
|
||||
for (x = 0; x < xo.length(); x++) {
|
||||
rv.push(xo[x]);
|
||||
console_log("info", "----" +xo[x] + "\n");
|
||||
}
|
||||
} else {
|
||||
rv.push("_no_idea_");
|
||||
}
|
||||
} else {
|
||||
if (interp.@score >= grammar_object.min_score) {
|
||||
if (interp.@score < grammar_object.confirm_score) {
|
||||
rv.push("_confirm_");
|
||||
@ -189,10 +205,12 @@ function SpeechDetect(session, mod, ip) {
|
||||
eval("xo = interp." + grammar_object.obj_path + ";");
|
||||
for (x = 0; x < xo.length(); x++) {
|
||||
rv.push(xo[x]);
|
||||
console_log("info", "----" +xo[x] + "\n");
|
||||
}
|
||||
} else {
|
||||
rv.push("_no_idea_");
|
||||
}
|
||||
}
|
||||
|
||||
delete interp;
|
||||
return rv;
|
||||
|
@ -33,8 +33,8 @@ include("js_modules/SpeechTools.jm");
|
||||
|
||||
function on_dtmf(a, b, c) {}
|
||||
|
||||
var dft_min = 10;
|
||||
var dft_confirm = 50;
|
||||
var dft_min = 0;
|
||||
var dft_confirm = 78;
|
||||
|
||||
/***************** Initialize The Speech Detector *****************/
|
||||
var asr = new SpeechDetect(session, "pocketsphinx");
|
||||
@ -130,7 +130,7 @@ pizza.toppingsObtainer.addItemAlias("ham", "ham");
|
||||
|
||||
/***************** Change Delivery Or Size Or Crust, Add/Rem Toppings Or Start Over *****************/
|
||||
pizza.arsoObtainer = new SpeechObtainer(asr, 1, 5000);
|
||||
pizza.arsoObtainer.setGrammar("pizza_arso", "", "result", dft_min, dft_confirm, true);
|
||||
pizza.arsoObtainer.setGrammar("pizza_arso", "", "result", dft_min, 50, true);
|
||||
pizza.arsoObtainer.setTopSound("GP-ARSO");
|
||||
pizza.arsoObtainer.setBadSound("GP-NI");
|
||||
pizza.arsoObtainer.addItemAlias("^delivery$", "delivery");
|
||||
@ -142,7 +142,7 @@ pizza.arsoObtainer.addItemAlias("^remove\\s*", "rem_topping");
|
||||
|
||||
/***************** Yes? No? Maybe So? *****************/
|
||||
pizza.yesnoObtainer = new SpeechObtainer(asr, 1, 5000);
|
||||
pizza.yesnoObtainer.setGrammar("pizza_yesno", "", "result", dft_min, dft_confirm, true);
|
||||
pizza.yesnoObtainer.setGrammar("pizza_yesno", "", "result", dft_min, 40, true);
|
||||
pizza.yesnoObtainer.setBadSound("GP-NI");
|
||||
pizza.yesnoObtainer.addItemAlias("^yes,^correct", "yes");
|
||||
pizza.yesnoObtainer.addItemAlias("^no", "no");
|
||||
|
Loading…
Reference in New Issue
Block a user