programAB + sphinx + acapela + french = problem :-D

Hello,

In french, we use accents (éèöî ....) and if the text to send contain accent, it seem that htmlFilter clear all the text . So acapela return an empty mp3... 

[sweety.htmlFilter] [DEBUG] --invoking sweety.htmlFilter.onText(Désolé, mes réponses sont limitées) 1451321442922 --
[sweety.htmlFilter] [DEBUG] msg [msg sweety.htmlFilter.publishText --> .publishText(Désolé, mes réponses sont limitées) - 1451321442930]
[sweety.htmlFilter] [DEBUG] msg [msg sweety.htmlFilter.onText --> .onText() - 1451321442931]

If i try to use accent on accapela website, that work.

My aiml file use encoding="ISO-8859-15"

 

And another problem : sphinx don't like the stars from programAB .

<category>
    <pattern>*</pattern>
    <template>Sorry my answers are limited</template>
</category>

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

Because, i think it can't create the grammar for the stars ...

[sweety.ear_ear] [ERROR] sweety.ear error RuntimeException - Allocation of search manager resources failed java.lang.RuntimeException: Allocation of search manager resources failed
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:650)
    at edu.cmu.sphinx.decoder.AbstractDecoder.allocate(AbstractDecoder.java:87)
    at edu.cmu.sphinx.recognizer.Recognizer.allocate(Recognizer.java:168)
    at org.myrobotlab.service.Sphinx$SpeechProcessor.run(Sphinx.java:121)
Caused by: java.io.IOException: edu.cmu.sphinx.jsgf.JSGFGrammarParseException
    at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:304)
    at edu.cmu.sphinx.linguist.language.grammar.Grammar.allocate(Grammar.java:116)
    at edu.cmu.sphinx.linguist.flat.FlatLinguist.allocate(FlatLinguist.java:300)
    at edu.cmu.sphinx.decoder.search.SimpleBreadthFirstSearchManager.allocate(SimpleBreadthFirstSearchManager.java:646)
    ... 3 more
Caused by: edu.cmu.sphinx.jsgf.JSGFGrammarParseException
    at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:132)
    at edu.cmu.sphinx.jsgf.parser.JSGFParser.newGrammarFromJSGF(JSGFParser.java:241)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.loadNamedGrammar(JSGFGrammar.java:697)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.commitChanges(JSGFGrammar.java:613)
    at edu.cmu.sphinx.jsgf.JSGFGrammar.createGrammar(JSGFGrammar.java:300)
    ... 6 more

 

kwatters's picture

Répète après moi...

bonjour beetlejuice!

Ok, so a few things could be going on here, (having the no worky would help me see)

1. sphinx kinda sucks,  It definitely does NOT support wildcards.  That's the reason we added the WebkitSpeechRecognition.  It's much better and it handles many different languages!  Only drawback is that you need to use the google Chrome & the webgui to use it.

2. the html filter is pretty dumb class, I don't think it's messing with the char encoding or stripping them out.  the html filter only removes text between < and > signs, so I don't think that's the problem.

3. it seems that acapela speech fails when you pass it non ascii text, using their web demo does work, so this looks like a bug that we should be able to fix.

 

 

kwatters's picture

URL Form encoding now supports UTF-8

Ahoy Beetlejuice..  

I think I just fixed the issue you were seeing.   It turns out that AcapelaSpeech API is expecting UTF-8 encoded text.  I just make sure that when we url form encode the data that we post, that we assume it's UTF-8 encoding now and it seems to be worky for me.   

The latest build should have the fix if you want to test it out. ( build 948 ) 

It was a small change, for more info have a look at:

https://github.com/MyRobotLab/myrobotlab/blob/develop/src/org/myrobotlab...

Good luck!

Mats's picture

UTF-8 encoding

Hi

Did you also test from Python ? I tested to save a python file in UTF-8 and that failed already in the editor. The Acapella speach worked with swedish letters like åäö before, when I had the python file saved in ANSI format. 

beetlejuice's picture

Thx, accents work well with

Thx, accents work well with accapela now

The problem with webSpeechRecognition is that we need to push a button to talk . Not very nice to talk with a robot ...

 

kwatters's picture

reproduced

Hi Mats,

  Thanks for testing this.  I reproduced the problem using the swing based python gui.  It looks like the utf-8 text in the python window is being interpreted as the local charset and it's mangling the data.  I'll see about updating it so it uses UTF-8 everywhere...  That should support all accent chars , chinese, japanese, etc.. 

 

kwatters's picture

Python likes Unicode...

So, I did some more testing and I found that Python likes it if you tell it that the string is actually unicode.

Below is an example that works properly:

acapelaSpeech = Runtime.createAndStart("speech", "AcapelaSpeech")
acapelaSpeech.speak(u'Répète après moi')
 
note the "u" before the string, this indicates to python that the string is already in unicode and shouldn't be decoded.  This should work for you (I hope)
Mats's picture

Yes it works

Thanks. I just have to remember to put a u before each text string that contains a Swedish letter. It will probably work for most european languages.

moz4r's picture

thanks ! i will test

thanks ! i will test this

Small question is JAW and ACAPELA relation broken on last versions ?

sound ok but jaw cant work anymore ( manual jaw movement is ok )

 

 

beetlejuice's picture

Hi

I've a new problem ; Conditions don't work

 

<category>
	<pattern>MY NAME IS *</pattern>
	<template><think><set name="name"><star /></set></think>Glad to meet you <star /></template>
</category>

 

<category>
	<pattern>WHAT'S MY NAME</pattern>
	<template><condition name="name" exists="false">I don't know</condition><condition name="name" exists="true">Your name is <get name="name" /></condition></template>
</category>

 

<category>
	<pattern>DO YOU KNOW MY NAME</pattern>
	<template><condition name="name" exists="false">No, </condition><condition name="name" exists="true">Yes, </condition><srai>quel est mon nom</srai></template>
</category>

"My name is" work, but the two other return an empty line in MRL

 

Mastablasta's picture

AIML file

Hi beetlejuice. I fixed the file for you. If you ask "whats my name" or "do you know my name" before you entered your name the bot will return "I don't know your name". If you enter your name (e.g. beetlejuice) before you will get the return "your name is beetlejuice"

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">

<category>
<pattern>MY NAME IS *</pattern>
<template><think><set name="name"><star/></set></think>Glad to meet you <star/></template>
</category>
    
<category>
<pattern>WHAT IS MY NAME</pattern>
<template><condition name="name">
<li value="*">Your name is <get name="name"/></li>
<li>I don't know your name.</li></condition>
</template>
</category>

<category>
<pattern>DO YOU KNOW MY NAME</pattern>
<template><srai>WHAT IS MY NAME</srai>
</template>
</category>

</aiml>

moz4r's picture

MouthControl.java

I think this is why about jaw problem and maybe others :

MouthControl.java work in progress, speech refactoring.

https://github.com/MyRobotLab/myrobotlab/commit/7854daf91a2101d5687475dd321251c03a9740e8

or i make mistake somewhere ?

i try a lot of python this is the last :

import time
from time import sleep
i01 = Runtime.createAndStart("i01", "InMoov")
left = Runtime.start("i01.left", "Arduino")
left.setBoard("atmega2560")
left.setBoardMega()
i01.startHead("/dev/ttyACM0","atmega2560")
i01.head.jaw.setMinMax(45,70)
i01.head.jaw.setRest(45)
i01.head.jaw.rest()
i01.startMouthControl("/dev/ttyACM0")
i01.mouthControl.setmouth(45,70)
#i01.mouthControl.autoAttach = True
i01.startMouth()
i01.mouth.speak("hello")
i01.mouth.speakBlocking("world")
sleep(5)
i01.detach()