[Freeswitch-svn] [commit] r9003 - in freeswitch/trunk/scripts: . js_modules

Freeswitch SVN brian at freeswitch.org
Sat Jul 12 11:41:04 EDT 2008


Author: brian
Date: Sat Jul 12 11:41:04 2008
New Revision: 9003

Modified:
   freeswitch/trunk/scripts/js_modules/SpeechTools.jm
   freeswitch/trunk/scripts/ps_pizza.js

Log:
tweaks to speech tools to score differently for pocketsphinx

Modified: freeswitch/trunk/scripts/js_modules/SpeechTools.jm
==============================================================================
--- freeswitch/trunk/scripts/js_modules/SpeechTools.jm	(original)
+++ freeswitch/trunk/scripts/js_modules/SpeechTools.jm	Sat Jul 12 11:41:04 2008
@@ -63,7 +63,7 @@
 	this.AutoUnload = false;
 	this.debug = false;
 
-	/* Set the TTS info*/
+	/* Set the TTS info */
 	this.setTTS = function (tts_eng, tts_voice) {
 		this.tts_eng = tts_eng;
 		this.tts_voice = tts_voice;		
@@ -79,7 +79,7 @@
 		this.audio_ext = audio_ext;
 	}
 	
-	/* Add a grammar to be used*/
+	/* Add a grammar to be used */
 	this.addGrammar = function(grammar_object) {
 		this.grammar_hash[grammar_object.grammar_name] = grammar_object;
 	}
@@ -180,18 +180,36 @@
 					console_log("debug", "----Heard [" + interp.input + "]\n");
 					console_log("debug", "----Hit score " + interp. at score + "/" + grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");
 				}
-				
-				if (interp. at score >= grammar_object.min_score) {
-					if (interp. at 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]);
+				if (this.mod == "pocketsphinx") {
+					/* pocketsphinx scores 0 best to 100 worst. */
+					if (interp. at score >= grammar_object.min_score) {
+						if (interp. at 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 {
-					rv.push("_no_idea_");
+					if (interp. at score >= grammar_object.min_score) {
+						if (interp. at 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_");
+					}
 				}
 
 				delete interp;
@@ -234,7 +252,7 @@
 
 	this.waitTime = wait_time + 0;
 
-	/* Set the TTS info*/
+	/* Set the TTS info */
 	this.setTTS = function (tts_eng, tts_voice) {
 		this.tts_eng = tts_eng;
 		this.tts_voice = tts_voice;		
@@ -277,7 +295,7 @@
 		this.add_sound = add_sound;		
 	}
 
-	/* Add acceptable items (comma sep list)*/
+	/* Add acceptable items (comma sep list) */
 	this.addItem = function(item) {
 		ia = item.split(",");
 		var x;

Modified: freeswitch/trunk/scripts/ps_pizza.js
==============================================================================
--- freeswitch/trunk/scripts/ps_pizza.js	(original)
+++ freeswitch/trunk/scripts/ps_pizza.js	Sat Jul 12 11:41:04 2008
@@ -33,8 +33,8 @@
 
 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 @@
 
 /***************** 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 @@
 
 /***************** 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");



More information about the Freeswitch-svn mailing list