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

GetProfiles Method


The GetProfiles method returns a selection of the available user speech profiles.

Profiles are stored in the speech configuration database as a series of tokens, with each token representing one profile. GetProfiles retrieves all available profile tokens. The returned list is an ISpeechObjectTokens object. Additional or more detailed information about the tokens is available in methods associated with ISpeechObjectTokens.

The token search may be further refined using the RequiredAttributes and OptionalAttributes search attributes. Only tokens matching the specified RequiredAttributes search attributes are returned. Of those tokens matching the RequiredAttributes key, OptionalAttributes lists devices in the order matching OptionalAttributes. If no search attributes are offered, all tokens are returned. If no audio devices match the criteria, GetAudioInputs returns an empty selection, that is, an ISpeechObjectTokens collection with an ISpeechObjectTokens::Count property of zero.

See Object Tokens and Registry Settings White Paper for a list of SAPI 5-defined attributes.


SpeechRecognizer.GetProfiles(
     [RequiredAttributes As String = ""],
     [OptionalAttributes As String = ""]
) As ISpeechObjectTokens

Parameters

RequiredAttributes
[Optional] Specifies the RequiredAttributes. To be returned by GetProfiles, profile tokens must contain all of the specific required attributes. If no profiles match the selection, the selection returned will not contain any elements. By default, no attributes are required and so returns all the tokens discovered.
OptionalAttributes
[Optional] Specifies the OptionalAttributes. Returned tokens containing the RequiredAttributes are sorted by OptionalAttributes. If OptionalAttributes is specified, the tokens are listed with the OptionalAttributes first. By default, no attribute is specified and the list returned from the speech configuration database is in the order that attributes were discovered.

Return Value

An ISpeechObjectTokens object.


Remarks

The format of selection criteria may either be Value or "Attribute = Value". Values may be excluded by "Attribute != Value".

See ISpeechRecognizer.Profile for related details.

Example

This code sample demonstrates the GetProfiles and Profile method. After creating an instance for a recognizer, GetProfiles polls the computer for available profile tokens. The results are displayed. The first one listed is the current profile. Clicking the button will change the current profile to the first different profile found.

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 the recognizer. The string functions in the middle of the Form_Load loop lets the application display only the ID portion of the ID string; the complete ID string can be long, exceeding a reasonably sized label.

    It is possible for your computer to have only one profile. To demonstrate this application, additional profiles should be added. Add new profiles through Speech properties of Control Panel.

    Public SharedRecognizer As SpSharedRecognizer
    Public theRecognizers As ISpeechObjectTokens
        
    Private Sub Command1_Click()
        Label1.Caption = ""
        
        Dim currentProfile As SpObjectToken
        Set currentProfile = SharedRecognizer.Profile
        
        For i = 0 To theRecognizers.Count - 1
            Set tokenObject = theRecognizers.Item(i)
            If tokenObject.Id <> currentProfile.Id Then
                Set SharedRecognizer.Profile = tokenObject
                Label1.Caption = Label1.Caption & "New Profile installed: " & SharedRecognizer.Profile.GetDescription
                Exit For
            End If
        Next i
    End Sub
    
    Private Sub Form_Load()
        Set SharedRecognizer = CreateObject("SAPI.SpSharedRecognizer")
        
        Set theRecognizers = SharedRecognizer.GetProfiles
        
        Dim i, idPosition As Long
        Dim tokenObject As SpObjectToken
    
        Label1.Caption = ""
        For i = 0 To theRecognizers.Count - 1
            Set tokenObject = theRecognizers.Item(i)
            Label1.Caption = Label1.Caption & tokenObject.GetDescription & vbCrLf
            
            idPosition = InStrRev(tokenObject.Id, "\")
            Label1.Caption = Label1.Caption & Mid(tokenObject.Id, idPosition + 1) & vbCrLf
            
            Label1.Caption = Label1.Caption & vbCrLf
        Next i
    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