SpeechRecognizer problem

Hello:
I have reset my smartphone to factory settings and since then apps using SpeechRecognizer recognize dictated numbers as text, but using the math block "is it a number?" no longer converts "fifty" to 50.
Before the reboot everything was working fine.
When I dictate a number to Google Assistant, it does convert it directly to a number.
I appreciate possible solution. Thank you.

Hi Miguel

It does work, so I imagine there must be more than the number captured - perhaps a space character?

blocks

Capture

When did this ever evaluate to true?

Google Assistant sounds smart, able to recognize word patterns like SIXTEEN TWENTY and translate them into numbers like 1620.

I started to code some blocks that would attempt text number recognition, but they got hairy, much harder than the reverse problem of converting numbers into text.

Maybe you can call Google Assistant through the Activity Starter?

Dear @Miguel_Angel_Alvarez,
after your resetting, have you restored the desired language at Android system level ?
I mean Language Preferences ? Because I'm italian, I remember that after a reset in which the base language returned to English, I needed to re-install the Italian language before the Speech Recognizer was able to understand me again ('cause I'm speaking italian, of course :slight_smile: ).
Also, in some cases, I saw that, when I said a number, the recognizer was writing (in a label that I set for debug purposes) the cipher but some others it was writing the letters (i.e. in italian 4 or "quattro"). Maybe these cases do not apply for you, but this is what happened to me.
Cheers, Ugo.

1 Like

Hello Uskiara, when I tell him any number, he presents it as alphabetic text in the microphone interface, but when it has to appear in the corresponding text field in numerical format, his response is: "Please repeat", leaving the field blank .
Of course the language is set correctly.
Thanks for answering.

Hi @Miguel_Angel_Alvarez, recently I've posted a chunk of code related to a "continuous speech recognizer".
You can find the aia here annexed. Maybe working on (or taking ideas from) it you can solve your problem ?
(hoping so :slight_smile: )
Cont_Speech.aia (88.2 KB)

I think the issue is you want a numerical representation and not a text but the text could be potentially any number, integers or floats. Also, does the App always want numerical representation or would text representation occasionally be preferred?

So - the conversion from text to number would require a look-up list of infinite length. How the Google Assistant achieves this would be interesting to know (AI?).

What you could do is ask the User to pause speech input just before the number, type-in the number, then continue speech input.

Dear @Miguel_Angel_Alvarez,
in addition to what Chris has said, please take a look here below to my blocks implementing the continuous recognizer that I use to switch between (virtual) screens on my digital car dashboard.
When I want to change screen (for example to switch to screen number 2), i say "schermo due", and the recognizer sometimes interprets it as "schermo due", some others as "schermo 2". For this reason my checks are double. I don't know why it happens, but it happens (Android 9, on newer ones, I don't know).

Anyway, please try my .aia, that I posted before: if you say any number you can see that numbers are showns as digits, also floating ones.

All the best, ugo.

Thanks Uskiara.
La aplicación siempre ha funcionado bien. Siempre.
Desde el reset de fábrica está fallando.
Tengo la configuración de idioma OK.
La app funciona así:
Digo un dato númerico con el componente SpeechRecognizer. En la interface o ventana del micrófono, aparece el dato que he pronunciado en formato texto (twenty three, one hundred forty four, or any number) hasta aquí todo bien, pero desde del componente TextToSpeech no se envía la cifra pronunciada al TextBox que ha de recibir el dato.

The Speech Recognizer uses the speech engine found on your device. The factory reset probably reverted to an earlier version or different engine. Do you recall installing a different one? If so, that would be the cause and the solution of the issue.

1 Like

Hi @Miguel_Angel_Alvarez, (sorry, though I understand Spanish, I continue in English for more readability by the community)
Ok, let's verify two things:

  1. in the "else" path, put a display to a label so to see "exactly" what the Speech Recognizer has received and understood.
    As @Chris said, probably there are some non-numeric characters (like a space or a blank) that is foolishing the "is number" block. If this is the case (or the cause) you can use the "trim" block to cancel any heading or trailing blanks.
  2. allow some time between the TextToSpeech and the SpeechRecognizer. To do so, put a clock of about 500 ms between the two actions. In other words, before starting the speech recognizer, wait for 500 ms after the completion of the text to speech, then start it. (Look at my .aia: i have clocks to allow the Speech Recognizer to do its various jobs)

Honestly it is pretty weird that before resetting was functioning well but, I truly believe it.
In effect I had some problems when the Android version has been updated, so the question is: after having reset, has your Android been updated also ? i.e. has it passed from version "x" to version "x+1" ?

One step beyond...(to Madness :slight_smile: )
Ciao, Ugo.

PS I saw last @ChrisWard post after mine. In effect we both are thinking about the "updating or regression" of something related to the System during the factory reset.... :frowning_face:

1 Like

I'll try to pause in time.
This is where the jam occurs.


Thanks for answering.

Dear @Miguel_Angel_Alvarez,
Have you already tried both options ?
image
I mean legacy/not legacy ?
Ciao.

Legacy yes.

Yes, but if not legacy ? Have you tried both ?

Yes, I already tried unchecking UseLegacy and same result.

Before the factory reset, when dictating a number with SpeechRecognizer, the value always appeared as a number, not text, which is how it appears now. And the math block "Is it a number?" it doesn't recognize it as numeric.

That is the problem - the factory reset has restored the original speech engine. You will have been using a later version. Re my post#12, if you install Google Speech Services (they have changed the name) your phone will then have Google's very latest speech engine. That might rescue your App.

Hello @Miguel_Angel_Alvarez,
99% the root cause is what Chris has said, but another thing that I see is that you get the text from the speech recognizer by using the block
image

while I use the variable "result" of the AfterGettingText block.
image

Maybe the "orange" variable (result) has a different format and is not converted yet into a full text ?

I wanted to test this hypotesis but unfortunately both AI2 servers are down (at least today from Italy i'm getting the error message).
Ciao, Ugo.