How do I manage lexicons with Microsoft Speech Platform?

Last reviewed: 3/1/2012

HOW Article ID: H031202

The information in this article applies to:

  • LexiconKit 4

Summary

LexiconKit 4 provides support for Microsoft Speech Platform.

More Information

Chant LexiconKit 4 provides support creating and editing application lexicons for Microsoft Speech Platform recognizers and voices.

Both 32-bit and 64-bit applications can create and edit lexicons for Microsoft Speech Platform recognizers and voices. The 32-bit Microsoft Speech Platform runtime must be installed to support 32-bit applications. The 64-bit Microsoft Speech Platform runtime must be installed to support 64-bit applications.

All current Microsoft Speech Platform versions are supported: v10.0, v10.1, v10.2 and v11.0. Only one version may be installed at a time. The runtimes, recognizers, and voices can be downloaded from Microsoft:

The recognizer for which to create and edit lexicons can be selected by setting the CSPEngine property to recognizer name or by setting the CNPEngineAPI value to CEMSPSR. The voice for which to create and edit lexicons can be selected by setting the CSPEngine property to voice name or by setting the CNPEngineAPI value to CEMSPTTS.


private Chant.LexiconKit.NChantLM NChantLM1;

// Instantiate NChantLM object
NChantLM1 = new NChantLM(this);
NChantLM1.SetStringProperty(ChantStringProperty.CSPEngine, "Microsoft Mary");

// Define an empty MSP application lexicon
resourceID = NChantLM1.DefineResource(ChantSpeechResource.CSRAppLexicon, "MaryWords", "Microsoft Mary");

// Add pronunciation to a lexicon resource
NChantLM1.AddResource(ChantSpeechResource.CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", ChantPartOfSpeech.CPOSNoun, 1);

// Export a lexicon resource to a file
NChantLM1.ExportResource(resourceID, "marywords.exe", 0);

CChantLM* m_pChantLM;  // ChantLM object

// Instantiate ChantLM object
m_pChantLM = new CChantLM();
m_pChantLM->SetStringProperty(CSPEngine, "Microsoft Mary");

// Define an empty MSP application lexicon
resourceID = pChantLM->DefineResource(CSRAppLexicon, L"MaryWords", L"Microsoft Mary");

// Add pronunciation to a lexicon resource
pChantLM->AddResource(CSRLexiconWordPronunciation, resourceID, L"tomato", L"t ax m aa t ow", CPOSNoun, 1);

// Export a lexicon resource to a file
pChantLM->ExportResource(resourceID, L"marywords.exe", 0);
    

CChantLM* ChantLM1;  // ChantLM object

// Instantiate ChantLM object
ChantLM1 = new CChantLM();
ChantLM1->SetStringProperty(CSPEngine, "Microsoft Mary");

// Define an empty MSP application lexicon
resourceID = pChantLM->DefineResource(CSRAppLexicon, "MaryWords", "Microsoft Mary");

// Add pronunciation to a lexicon resource
pChantLM->AddResource(CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", CPOSNoun, 1);

// Export a lexicon resource to a file
pChantLM->ExportResource(resourceID, "marywords.exe", 0);

var
ChantLM1: TChantLM;

begin
// Instantiate ChantLM object
ChantLM1 := TChantLM.Create();
ChantLM1.SetStringProperty(CSPEngine, 'Microsoft Mary');

// Define an empty MSP application lexicon
resourceID := ChantLM1.DefineResource(CSRAppLexicon, 'MaryWords', 'Microsoft Mary');

// Add pronunciation to a lexicon resource
ChantLM1.AddResource(CSRLexiconWordPronunciation, 'CurrentUserLexicon', resourceID, 't ax m aa t ow', CPOSNoun, 1);

// Export a lexicon resource to a file
ChantLM1.ExportResource(resourceID, 'marywords.exe', 0);

end;
    

private JChantLM JChantLM1;

// Instantiate ChantLM object
JChantLM1 = new JChantLM();
JChantLM1.setStringProperty(ChantStringProperty.CSPEngine, "Microsoft Mary");

// Define an empty MSP application lexicon
resourceID = JChantLM1.defineResource(ChantSpeechResource.CSRAppLexicon, "MaryWords", "Microsoft Mary");

// Add pronunciation to a lexicon resource
JChantLM1.addResource(ChantSpeechResource.CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", ChantPartOfSpeech.CPOSNoun, 1);

// Export a lexicon resource to a file
JChantLM1.exportResource(resourceID, "marywords.exe", 0);
    

WChantLM1.SetStringProperty(CSPEngine, "Microsoft Mary");

// Define an empty MSP application lexicon
resourceID = WChantLM1.DefineResource(CSRAppLexicon, "MaryWords", "Microsoft Mary");

// Add pronunciation to a lexicon resource
WChantLM1.AddResource(CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", CPOSNoun, 1);

// Export a lexicon resource to a file
WChantLM1.ExportResource(resourceID, "marywords.exe", 0);
    

Dim WithEvents XChantLM1 As XChantLM

XChantLM1.SetStringProperty CSPEngine, "Microsoft Mary"

' Define an empty MSP application lexicon
Dim resourceID as Integer
resourceID = XChantLM1.DefineResource(CSRAppLexicon, "MaryWords", "Microsoft Mary")

' Add pronunciation to a lexicon resource
XChantLM1.AddResource CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", CPOSNoun, 1

' Export a lexicon resource to a file
XChantLM1.ExportResource resourceID, App.Path & "\marywords.exe", 0
        

Dim WithEvents NChantLM1 As NChantLM

' Instantiate ChantLM object
NChantLM1 = New NChantLM(Me)
NChantLM1.SetStringProperty(ChantStringProperty.CSPEngine, "Microsoft Mary")

' Define an empty MSP application lexicon
Dim resourceID as Integer
resourceID = NChantLM1.DefineResource(ChantSpeechResource.CSRAppLexicon, "MaryWords", "Microsoft Mary")

' Add pronunciation to a lexicon resource
NChantLM1.AddResource(ChantSpeechResource.CSRLexiconWordPronunciation, resourceID, "tomato", "t ax m aa t ow", ChantPartOfSpeech.CPOSNoun, 1)

' Export a lexicon resource to a file
NChantLM1.ExportResource(resourceID, "marywords.exe", 0)