ISpeechRecoGrammar IsPronounceable method

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoGrammar

IsPronounceable Method


The IsPronounceable method determines if a word has a pronunciation.

Additionally, the SpeechWordPronounceable constant returned by this method indicates whether the word exists in the grammar object's lexicon. Words are likely to be pronounceable even if they are not found in the lexicon.


ISpeechRecoGrammar.IsPronounceable(
     Word As String
) As SpeechWordPronounceable

Parameters

Word
Specifies the Word.

Return Value

A SpeechWordPronounceable constant.


Example

The following Visual Basic form code demonstrates the use of the IsPronounceable method.

To run this code, create a form with the following controls:

  • A command button called Command1
  • A text box called Text1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates a grammar and loads the general dictation topic. The Command1_Click procedure passes the word or words in Text1 to the IsPronounceable method and displays the resulting SpeechWordPronounceable constant.

    Most correctly spelled words will be known and pronounceable; most incorrectly spelled words will be unknown and pronounceable. The example begins with a word which is pronounceable, even though it is misspelled.


    Option Explicit
    
    Dim C As SpeechLib.SpSharedRecoContext
    Dim G As SpeechLib.ISpeechRecoGrammar
    
    Private Sub Command1_Click()
        Dim strTemp As String
    
        Select Case G.IsPronounceable(Text1.Text)
        Case SWPKnownWordPronounceable
            strTemp = "KnownWordPronounceable"
        Case SWPUnknownWordPronounceable
            strTemp = "UnknownWordPronounceable"
        Case SWPUnknownWordUnpronounceable
            strTemp = "UnknownWordUnpronounceable"
        End Select
        
        MsgBox "The word """ & Text1.Text & """ is " & strTemp
        
    End Sub
    
    Private Sub Form_Load()
    
        Set C = New SpSharedRecoContext
        Set G = C.CreateGrammar
        
        G.DictationLoad ""
        
        Text1.Text = "missspeled"
        
    End Sub