[Freeswitch-svn] [commit] r9194 - in freeswitch/trunk: scripts scripts/js_modules src/mod/applications/mod_snom src/mod/asr_tts/mod_pocketsphinx

Freeswitch SVN brian at freeswitch.org
Mon Jul 28 21:25:30 EDT 2008


Author: brian
Date: Mon Jul 28 21:25:29 2008
New Revision: 9194

Modified:
   freeswitch/trunk/scripts/js_modules/SpeechTools.jm
   freeswitch/trunk/scripts/ps_pizza.js
   freeswitch/trunk/src/mod/applications/mod_snom/   (props changed)
   freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c

Log:
lets flip it around. 0 bad 100 good in pocketsphinx now.  Scoring in the lib was changed so I had to do this change

Modified: freeswitch/trunk/scripts/js_modules/SpeechTools.jm
==============================================================================
--- freeswitch/trunk/scripts/js_modules/SpeechTools.jm	(original)
+++ freeswitch/trunk/scripts/js_modules/SpeechTools.jm	Mon Jul 28 21:25:29 2008
@@ -181,43 +181,26 @@
 					console_log("debug", "----Hit score " + interp. at score + "/" + grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");
 				}
 
-				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_");
+				if (interp. at score >= grammar_object.min_score) {
+					if (interp. at score < grammar_object.confirm_score) {
+						rv.push("_confirm_");
 					}
-				} else {
-					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_");
+					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;
 			}
+			delete interp;
+			return rv;
 		}
 	}
-} 
+}
 
 /* Constructor for SpeechObtainer Class (Class to collect data from a SpeechDetect Class) */
 function SpeechObtainer(asr, req, wait_time) {

Modified: freeswitch/trunk/scripts/ps_pizza.js
==============================================================================
--- freeswitch/trunk/scripts/ps_pizza.js	(original)
+++ freeswitch/trunk/scripts/ps_pizza.js	Mon Jul 28 21:25:29 2008
@@ -33,8 +33,8 @@
 
 function on_dtmf(a, b, c) {}
 
-var dft_min = 0;
-var dft_confirm = 78;
+var dft_min = 40;
+var dft_confirm = 70;
 
 /***************** Initialize The Speech Detector  *****************/
 var asr = new SpeechDetect(session, "pocketsphinx");
@@ -142,7 +142,7 @@
 
 /***************** Yes? No? Maybe So?  *****************/
 pizza.yesnoObtainer = new SpeechObtainer(asr, 1, 5000);
-pizza.yesnoObtainer.setGrammar("pizza_yesno", "", "result", dft_min, 40, true);
+pizza.yesnoObtainer.setGrammar("pizza_yesno", "", "result", dft_min, 20, true);
 pizza.yesnoObtainer.setBadSound("GP-NI");
 pizza.yesnoObtainer.addItemAlias("^yes,^correct", "yes");
 pizza.yesnoObtainer.addItemAlias("^no", "no");

Modified: freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	Mon Jul 28 21:25:29 2008
@@ -365,7 +365,7 @@
 {
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info; 
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	int32_t conf, lconf;
+	int32_t conf;
 
 	if (switch_test_flag(ps, PSFLAG_BARGE)) {
 		switch_clear_flag_locked(ps, PSFLAG_BARGE);
@@ -375,14 +375,11 @@
 	if (switch_test_flag(ps, PSFLAG_HAS_TEXT)) {
 		switch_mutex_lock(ps->flag_mutex); 
 		switch_clear_flag(ps, PSFLAG_HAS_TEXT);
-		
 		conf = ps_get_prob(ps->ps, &ps->uttid);
-		lconf = (int32_t)logmath_log_to_ln(ps_get_logmath(ps->ps), conf);
-		ps->confidence = lconf - lconf - lconf;
 
-		if (ps->confidence > 1000) {
-			ps->confidence = 1000;
-		} else if (ps->confidence < 0) {
+		ps->confidence = (conf + 20000) / 200;
+
+		if (ps->confidence < 0) {
 			ps->confidence = 0;
 		}
 



More information about the Freeswitch-svn mailing list