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: ISpeechRecoContext

Bookmark Method


The Bookmark method sets a bookmark within the current recognition stream.

A bookmark relates an audio stream position with an occurrence significant to the application. The speech recognition (SR) engine has a latency period between the speech and the recognition. This latency may be caused by a long speech period (the engine must have all the phrase before processing it) or other events may already be queued and the engine must finishing process those first. However, during that latent period, the user or application may continue operations (such as moving the mouse or speaking). As a result, the condition of the application may be different when the recognition comes back than it was when recognition was initiated. A bookmark allows the application to mark or record a condition of the application to a particular recognition attempt.

Bookmark is a convenient alternative to polling the engine for stream position (see ISpeechRecognizer.Status). A Bookmark event is returned when the bookmark has been processed by the engine. See ISpeechRecoContext.Bookmark for further information.


SpeechRecoContext.Bookmark(
     Options As SpeechBookmarkOptions,
     StreamPos As Variant,
     BookmarkId As Variant
)

Parameters

Options
Specifies whether the recognition context will pause when encountering bookmarks. This must be value of type SpeechBookmarkOptions.
StreamPos
Specifies the stream position. This value may be anywhere in the stream and will send a Bookmark event when that position is reached. Additionally it may be any one of two special values: Speech_StreamPos_Asap or Speech_StreamPos_RealTime.
BookmarkId
Specifies the BookmarkId. BookmarkId is additional information provided by the application and is unique to the application. As a Variant data type, it may be numeric, String, or any other format and is used to pass information within the method or event. If BookmarkId is a String, the value must be able to convert to a numeric value. This information is returned back using the Bookmark event.

Return Value

None.


Remarks

An application that wants to display a recognition progress meter, for example could use ISpeechRecoContext.Bookmark and update the UI when each bookmark is received.

Example

This code snippet demonstrates initiation of a Bookmark event at the start of the each speech recognition stream by setting the StreamPos to zero. Each event is identified with BookmarkId of "10" and that value may be used inside the event for additional processing. Additional events may be indicated by adding new Bookmarks. After the grammar is closed, a Bookmark event with BookmarkId of "99" is sent.

This example assumes valid speech processing support and that FileName points to a valid grammar file.

Dim SharedRecognizer As Object
Dim WithEvents SharedReco As SpSharedRecoContext

Dim RecoGrammar As Object
Set RecoGrammar = Context.CreateGrammar(123)
RecoGrammar.CmdLoadFromFile FileName

'This bookmark is initiated before speech recognition
SharedReco.Bookmark SBONone, 0, "10"

'Speech processing code here

RecoGrammar.CmdSetRuleState "", SGDSInactive
SharedReco.Bookmark SBONone, 0, "99"

The corresponding Bookmark could be defined as this. This allows further refinement of the processing after the event occurs. Notice BookmarkId is converted to a numeric value.

Private Sub InProcRecoContext_Bookmark(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal BookmarkId As Variant, ByVal Options As SpeechLib.SpeechBookmarkOptions)
    If BookmarkId = 10 Then
        'Some processing code goes here
    ElseIf BookmarkId = 99 Then
        'Some processing code goes here
    End If
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
BookmarkId can also be one of the two predefined constants: Speech_StreamPos_Asap and Speech_StreamPos_RealTime, which are 0 and -1. Speech_StreamPos_Asap means Bookmark event will occur when the SR engine reaches a synchronization point, and be fired as soon as possible. Speech_StreamPos_RealTime means Bookmark event will occur when the SR engine reaches the current audio device position.