Results 1 to 11 of 11

Thread: oh spee

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    oh spee

    hi peeps

    i'm back treading precariously through the realms of visual basic once again!!

    this time it's about speech recognition, remember that dictionary program? well i managed to extract the words from the database ok but now i'd like for the user to dictate a word and the application to locate it in the database.

    i've got speech recognition working in that it identifies dictated words hard coded into the vb code such as:


    VB Code:
    1. Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
    2.  
    3. Dim sFile As String
    4. Dim noth As Long
    5.  
    6. Select Case Phrase
    7.  
    8.    Case "gardun"
    9.    txtSearchWord.Text = "grdn"
    10.    
    11.    Case "paagal"
    12.    txtSearchWord.Text = "pwgl"
    13.    
    14.  
    15. End Select
    16.    
    17.    
    18. Else: Text1.Text = "No word matched"





    VB Code:
    1. Private Sub Form_Load()
    2.  
    3. Set dbMyDB = OpenDatabase("C:\Amar\Uni\Dissertation\the works\databases\db6.mdb") ' if c:\MSAdb.mdb is database name & path
    4. Dim totaldata As String
    5.  
    6. totaldata = "[Grammar]" & vbCrLf & _
    7. "langid = 1033" & vbCrLf & _
    8. "type=cfg" & vbCrLf & _
    9. "[<Start>]" & vbCrLf & _
    10. "<Start>=gardun" & vbCrLf & _
    11. "<Start>=paagal" & vbCrLf & _
    12. "<Start>=Media Player" & vbCrLf
    13.  
    14. DirectSR1.GrammarFromString (totaldata)
    15.  
    16.  
    17.  
    18. End Sub


    the above code works fine but obviously i cant put all the words for my dictionary into the code, it too unpractical (not to mention silly!) so i tried to locate the variable
    Phrase
    in the database using the same method i used to located the EngWord (which by the way is working), so i tried this:


    VB Code:
    1. Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
    2.  
    3.  
    4. If SourceLanguage = "ENGLISH" Then
    5.  
    6. SQL = "Select * from EUHToPunjabi where SpeechRecogEnglish ='" & Phrase & "'"
    7.  
    8. Set rsFindWord = dbMyDB.OpenRecordset(SQL)
    9.  
    10. MsgBox rsFindWord.RecordCount & " words found"
    11.  
    12. If rsFindWord.RecordCount <> 0 Then
    13.  
    14. frmDictateWord.Text1.Text = rsFindWord.Fields("EnglishWord")
    15.  
    16. End If


    this code however doesnt locate any records whatsoever when i type words that are in the database.

    hope y'all can help! much appreciated! thank you guys so much for helping on my previous post!

    thanks in advance

    Amar

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: oh spee

    VB Code:
    1. SQL = "Select * from EUHToPunjabi where SpeechRecogEnglish ='" & Phrase & "'"
    2. Debug.Print SQL
    See if the program is seeing what you think it's seeing.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    Re: oh spee

    hi how does debug.print work where is the output? i tried it but i dont know where it outputted to

    cheers

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,501

    Re: oh spee

    It is shown in the "Immediate Window". If you can't see that, just select it from the View menu of VB's IDE.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    Re: oh spee

    i cant seem to get the debug to work

    cheers

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: oh spee

    Quote Originally Posted by amarbolla
    i cant seem to get the debug to work

    cheers
    Do you mean you can't view the Immediate Window?

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    Re: oh spee

    oh sorry i meant i cant find the debug output

    i debugged manually and it says

    Select * from EUPToHindi where SpeechRecogEnglish =''
    Its not putting anything into Phrase so it's looking for " " in the database thereby not matching with any records.

    i think i'm going about it wrong aren't i?

    how do i assign to a variable and then look for that spoken phrase in the database? is that possible?

    what i'd like to do is:

    1..speak a word into the mic
    2.then look in my access database to see if it exists

    This works if i hard code the words into vb code though, not with a database

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: oh spee

    "Phrase" (I assume that's the name of a string variable) has to have the characters that you have stored in the database. You'll have to "train" the program first, speaking the words you want recognizable and storing the text representations of these words (which may not always be the correctly-spelled text versions of the words) in the database.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    Re: oh spee

    yes "Phrase" is a string variable.

    I have stored the words in a database and they are spelt as i want pronounced and not how they are spelt.

    How do i "train" the program? do i need to reference the word in code before it can find it in the database?

    so far when i say a word that is in the dictionary and debug the program, it shows me that the "Phrase" variable im trying to match to the field in the database is ' ' and contains nothing.

    thanx

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Apr 2006
    Posts
    27

    Re: oh spee

    hello peeps any luck?
    im still stuck!!

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,692

    Re: oh spee

    Quote Originally Posted by amarbolla
    yes "Phrase" is a string variable.

    I have stored the words in a database and they are spelt as i want pronounced
    They have to be spelled as the speech recognition software "spells" them.

    It might actually work better if you used soundex - that way some pronunciation differences wouldn't cause problems. See http://www.vbforums.com/showthread.php?t=372547.

    How do i "train" the program? do i need to reference the word in code before it can find it in the database?
    You speak the word and get the output of the t-t-s program into a string variable. That's the "word" you put into the database. (Or the soundex equivalent, if you're using soundex.)

    so far when i say a word that is in the dictionary and debug the program, it shows me that the "Phrase" variable im trying to match to the field in the database is ' ' and contains nothing.
    Where are you getting the string you're calling DirectSR1_PhraseFinish with - the string you call "Phrase"? It should be the output of the t-t-s program, not something you decided the spelling of.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width