CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecognizer

EmulateRecognition Method


The EmulateRecognition method emulates recognition from a textual source rather than from a spoken source.

Using EmulateRecognition, applications can accept input from either speech or a textual source. All the events are fired back to the application exactly as if a normal recognition had taken place. The result phrase will have the semantic properties set in the same way as a spoken result. A recognition event will be produced only if the text actually parses through the active rules (if dictation is active, any text will parse).

Since the recognition attempt will not use an audio data, certain events such Interference, Hypothesis, and AudioLevel cannot occur.


SpeechRecognizer.EmulateRecognition(
     TextElements As Variant,
     [ElementDisplayAttributes As Variant = SDA_No_Trailing_Space],
     [LanguageId As Long = 0]
)

Parameters

TextElements
Specifies the elements of the phrase to to recognize. It must be one of two cases. In either case, additional information may be specified for each element by using the following syntax on each TextElement: "/display_text/lexical_form/pronunciation;". This syntax can be used in both the BSTR and the array of BSTRs case.
ElementDisplayAttributes
[Optional] Specifies the SpeechDisplayAttributes value for each word element. This value is specific to the language and usually determined by the speech recognition engine. By default the value is SDA_No_Trailing_Space and is considered standard for English languages. This parameter is only valid if an array of BSTRs for the TextElements parameter is specified. It must be one of three cases.
LanguageId
[Optional] Specifies the LanguageId. This is the same as the Win32 Language Identifier (LANGID). By default the value is zero, indicating the system default is used.

Return Value

None.


Remarks

Use this method (simulating speech) to test applications that use speech recognition. Also the restrictions in the parameters TextElements and ElementDisplayAttributes accommodate languages not using spaces to separate words.

Example

The following Visual Basic form code demonstrates the use of EmulateRecognition. The application displays the successful recognition result of dictation. It also emulates speech by clicking the button.

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

  • A label called Label1
  • A command button called Command1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates and activates a dictation grammar. Click Command1 to start emulated speech and display results.

    Public WithEvents RC As SpSharedRecoContext
    Public myGrammar As ISpeechRecoGrammar
    
    Private Sub Command1_Click()
        RC.Recognizer.EmulateRecognition ("We the people")
    End Sub
    
    Private Sub Form_Load()
        Set RC = New SpSharedRecoContext
        Set myGrammar = RC.CreateGrammar
        
        myGrammar.DictationSetState SGDSActive
    End Sub
    
    Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
        Label1.Caption = Result.PhraseInfo.GetText
    End Sub
    


    You are reading help file online using chmlib.com

    If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
    Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web