iOS Question problem with speech recognition

HuZz

Member
Licensed User
Hi all,
i guess why, when speech_Result is fired, texts.clear (which would clear all items in Texts List) doesn't work...
is it necessary to stop recording before cleraing the list?
my purpose is to start recording and then check any word recorded... if the recorded word does match my keyword, then an event is fired. If this happen, i have to clear all previous recorded words, in order to start again with the process... dunno what's wrong...

thanks
 

HuZz

Member
Licensed User
Thanks Erel for your answer... i followed your example, but it's a bit different from what i need.
Here's the sub i call to check the word spoken:

B4X:
Private Sub speech_Result (Success As Boolean, IsFinal As Boolean, Texts As List)
    Dim stringToCheck As String
    If Success Then
        stringToCheck = Texts.Get(0)      
      
        If stringToCheck.Contains("lap") Then
            Log(stringToCheck)
            getLap
        End If
        Texts.Clear
    Else
            Label2.Text = "Error: " & LastException
    End If  
End Sub

At end of the sub i tried IsFinal statement (as in your example) but Texts.Clear doesn't work anyway...
 
Upvote 0

HuZz

Member
Licensed User
I try to explain better... i'm developing a stopwatch with speech recocgnition.
So, when the user click on Start button, recording starts... and anytime the user says "Lap", i call the getLap sub.
Anytime user says "Lap" it is added to the texts list, so if i do not clear the list, all previous words are still in the list. I would like to clear it in order to check for any single word spoken...
If this is not possible i think the other way is to check the size of the list and check the last word recorded...
 
Upvote 0

HuZz

Member
Licensed User
Thanks Erel... i already did that way!
i'm now splitting the elements of Texts list into a temp list (i've created my own split function within a stringFunctions class), then test the last element of my list to check if it's ok!
 
Upvote 0
Top