Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Speech / Src / Recognition / DictationGrammar.cs / 1 / DictationGrammar.cs
//---------------------------------------------------------------------------- //// Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- #if !SPEECHSERVER using System; using System.Diagnostics; namespace System.Speech.Recognition { // Class for grammars based on a statistical language model for doing dictation. /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar"]/*' /> public class DictationGrammar: Grammar { // The implementation of DictationGrammar stores a Uri in the Grammar.Uri field. // Then when LoadGrammar is called the Uri handling part of LoadGrammar is modified to check // if the grammar object is a DictationGrammar, in which case the SAPI dictation methods are called. // The Uri is "grammar:dictation" for regular dictation and "grammar:dictation#spelling" for a spelling. //******************************************************************* // // Constructors // //******************************************************************* #region Constructors // Load the generic dictation language model. /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.DictationGrammar1"]/*' /> public DictationGrammar() : base(_defaultDictationUri, null, null) { } // Load a specific topic. The topic is of the form "grammar:dictation#topic" /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.DictationGrammar2"]/*' /> public DictationGrammar(string topic) : base (new Uri(topic, UriKind.RelativeOrAbsolute), null, null) { } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.SetDictationContext"]/*' /> public void SetDictationContext(string precedingText, string subsequentText) { if (State != GrammarState.Loaded) { throw new InvalidOperationException(SR.Get(SRID.GrammarNotLoaded)); } // Note: You can only call this method after the Grammar is Loaded. // In theory we could support this more generally but there doesn't seem to be a lot of point. Debug.Assert(Recognizer != null); Recognizer.SetDictationContext(this, precedingText, subsequentText); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private static Uri _defaultDictationUri = new Uri("grammar:dictation"); #endregion } } #endif // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- //// Copyright (C) Microsoft Corporation. All rights reserved. // //--------------------------------------------------------------------------- #if !SPEECHSERVER using System; using System.Diagnostics; namespace System.Speech.Recognition { // Class for grammars based on a statistical language model for doing dictation. /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar"]/*' /> public class DictationGrammar: Grammar { // The implementation of DictationGrammar stores a Uri in the Grammar.Uri field. // Then when LoadGrammar is called the Uri handling part of LoadGrammar is modified to check // if the grammar object is a DictationGrammar, in which case the SAPI dictation methods are called. // The Uri is "grammar:dictation" for regular dictation and "grammar:dictation#spelling" for a spelling. //******************************************************************* // // Constructors // //******************************************************************* #region Constructors // Load the generic dictation language model. /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.DictationGrammar1"]/*' /> public DictationGrammar() : base(_defaultDictationUri, null, null) { } // Load a specific topic. The topic is of the form "grammar:dictation#topic" /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.DictationGrammar2"]/*' /> public DictationGrammar(string topic) : base (new Uri(topic, UriKind.RelativeOrAbsolute), null, null) { } #endregion //******************************************************************** // // Public Methods // //******************************************************************* #region Public Methods /// TODOC <_include file='doc\DictationGrammar.uex' path='docs/doc[@for="DictationGrammar.SetDictationContext"]/*' /> public void SetDictationContext(string precedingText, string subsequentText) { if (State != GrammarState.Loaded) { throw new InvalidOperationException(SR.Get(SRID.GrammarNotLoaded)); } // Note: You can only call this method after the Grammar is Loaded. // In theory we could support this more generally but there doesn't seem to be a lot of point. Debug.Assert(Recognizer != null); Recognizer.SetDictationContext(this, precedingText, subsequentText); } #endregion //******************************************************************** // // Internal Methods // //******************************************************************** #region Internal Methods #endregion //******************************************************************* // // Private Fields // //******************************************************************** #region Private Fields private static Uri _defaultDictationUri = new Uri("grammar:dictation"); #endregion } } #endif // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LogWriteRestartAreaAsyncResult.cs
- ObjectToModelValueConverter.cs
- CannotUnloadAppDomainException.cs
- DeleteBookmarkScope.cs
- XmlAnyElementAttribute.cs
- PackageRelationshipCollection.cs
- ResourceAttributes.cs
- PageAdapter.cs
- shaperfactoryquerycacheentry.cs
- EmptyCollection.cs
- FontWeight.cs
- DataFieldConverter.cs
- DecimalStorage.cs
- WebPartMenuStyle.cs
- CodeTryCatchFinallyStatement.cs
- GridSplitterAutomationPeer.cs
- Grid.cs
- FontStretches.cs
- ParameterCollectionEditorForm.cs
- ValueChangedEventManager.cs
- BadImageFormatException.cs
- MetadataArtifactLoaderFile.cs
- WebPartActionVerb.cs
- ToolBarOverflowPanel.cs
- IntegerFacetDescriptionElement.cs
- ConfigurationSectionHelper.cs
- OracleBoolean.cs
- ArraySubsetEnumerator.cs
- TableLayoutStyleCollection.cs
- BamlWriter.cs
- SoapSchemaMember.cs
- DbMetaDataCollectionNames.cs
- RequiredAttributeAttribute.cs
- PTProvider.cs
- Empty.cs
- PanelStyle.cs
- CrossAppDomainChannel.cs
- XmlUrlEditor.cs
- RefreshEventArgs.cs
- Ticks.cs
- GridViewColumn.cs
- Literal.cs
- DataObjectEventArgs.cs
- UpdatePanel.cs
- AttributeUsageAttribute.cs
- PropertyIdentifier.cs
- RegularExpressionValidator.cs
- GraphicsState.cs
- EntitySqlQueryState.cs
- FieldAccessException.cs
- ThemeDirectoryCompiler.cs
- WebRequestModuleElementCollection.cs
- FindResponse.cs
- RNGCryptoServiceProvider.cs
- HwndHost.cs
- OdbcError.cs
- DesignerDataConnection.cs
- UnsafeNativeMethods.cs
- BooleanSwitch.cs
- TagElement.cs
- IndexOutOfRangeException.cs
- XmlSchemaExternal.cs
- _NestedMultipleAsyncResult.cs
- PropertyManager.cs
- TypedAsyncResult.cs
- Site.cs
- SecurityTraceRecordHelper.cs
- SafeEventLogReadHandle.cs
- PageOutputQuality.cs
- NonBatchDirectoryCompiler.cs
- PageAsyncTaskManager.cs
- SrgsOneOf.cs
- LayoutExceptionEventArgs.cs
- XamlTypeMapper.cs
- DiagnosticsConfigurationHandler.cs
- CustomTokenProvider.cs
- IndicCharClassifier.cs
- CoreSwitches.cs
- StatusBarPanel.cs
- DataGridViewCellCollection.cs
- arabicshape.cs
- ContactManager.cs
- PageAsyncTaskManager.cs
- OptimizedTemplateContent.cs
- IUnknownConstantAttribute.cs
- ProxyGenerator.cs
- WpfKnownType.cs
- ProxyWebPartManager.cs
- OletxVolatileEnlistment.cs
- ToolStripSettings.cs
- ContextCorrelationInitializer.cs
- ElementProxy.cs
- WebDisplayNameAttribute.cs
- Vector3DIndependentAnimationStorage.cs
- PublishLicense.cs
- TransformPatternIdentifiers.cs
- SerialPinChanges.cs
- SamlAudienceRestrictionCondition.cs
- Soap12ProtocolImporter.cs
- DataPagerFieldItem.cs