• warning: get_headers() [function.get-headers]: This function may only be used against URLs in /var/www/html/myrobotlab/themes/superclean/repoFile.php on line 35.
  • warning: file_get_contents(//home/beetlejuice/wikiDataFetcher%2BAB%2BFR.py) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/html/myrobotlab/themes/superclean/repoFile.php on line 38.

WebkitSpeechRecognition interception before programAB

Hi ! Program AB doesn't like quotes ( ex: I'M A BOT ) it must be ( I M A BOT ) I think

And I want to correct some ear values.

So how can i intercept WebkitSpeechRecognition  and replace some characters before ProgramAB read it.

Thanks !

beetlejuice's picture

Hi !Here is a quick exemple

Hi !

Here is a quick exemple ( mayby not the better, but that work ! )

Runtime.createAndStart("chatBot", "ProgramAB") 
sleep (1)
chatBot.startSession( "default", "wikidataFR") 
Runtime.createAndStart("ear", "WebkitSpeechRecognition") 
mouth=Runtime.createAndStart("mouth", "AcapelaSpeech")
htmlFilter=Runtime.createAndStart("htmlFilter", "HtmlFilter")

ear.addListener("publishText", python.name, "talk") 
# Add route from Program AB to html filter
# Add route from html filter to mouth
htmlFilter.addListener("publishText", python.name, "say");
Runtime.createAndStart("webGui", "WebGui") 

def say(data):
	print "chatbot :", data
def talk(data):
	if data!="":
		data = data.replace("\'", " ") # Replace quote by a blank space
		chatBot.getResponse(data) # Ask the chatBot 
  		print "chatbot :", data


You need to have this category in your aiml file.

<pattern>SAY *</pattern>
<template><star /></template>


beetlejuice's picture

But ProgramAB work with

But ProgramAB work with quotes, you have to use UTF-8, have a look here:

moz4r's picture

merci beetle !!!! I will try

merci beetle !!!!

I will try it

moz4r's picture

Correct me if i wrong but It

Correct me if i wrong but It works but not really :) , why  :

QUEL EST LE fruit DE L'abricotier

the paterne called is :

<category><pattern>QUEL EST LE * DE *</pattern>


<category><pattern>QUEL EST LE * DE L'*</pattern>

I want to use this outside the wikidata service in classic aiml pattern

So the talk function is not called at this time. I need to intercept the data before ProgramAB fetch it . Any idea ?

moz4r's picture

I foundt it

this is the tip : ( remove chatbot listener )


def onText(text):
 print text.replace("'", " ")
 chatBot.getResponse(text.replace("'", " "))