TtsEngineSsml.RemoveLexicon(Uri, ITtsEngineSite) Method


移除由当前 Synthesizer 实例实现的 VoiceTtsEngineSsml 当前加载的字典。Removes a lexicon currently loaded by the SynthesizerVoice implemented by the current TtsEngineSsml instance.

 abstract void RemoveLexicon(Uri ^ uri, System::Speech::Synthesis::TtsEngine::ITtsEngineSite ^ site);
public abstract void RemoveLexicon (Uri uri, System.Speech.Synthesis.TtsEngine.ITtsEngineSite site);
abstract member RemoveLexicon : Uri * System.Speech.Synthesis.TtsEngine.ITtsEngineSite -> unit
Public MustOverride Sub RemoveLexicon (uri As Uri, site As ITtsEngineSite)



指示词典信息位置的 System.Uri 的有效实例。A valid instance of System.Uri indicating the location of the lexicon information.


对由平台基础结构传入以允许访问基础结构资源的 ITtsEngineSite 接口的引用。A reference to an ITtsEngineSite interface passed in by the platform infrastructure to allow access to the infrastructure resources.


RemoveLexicon 的实现使用词典 URI 来查询 System.IO.Stream的实例 System.Collections.Generic.Dictionary,关闭流并删除引用词典的 URI。The implementation of RemoveLexicon uses the lexicon URI to query an instance System.Collections.Generic.Dictionary for the System.IO.Stream, closes the stream and removes the uri referring to the lexicon.

public static Dictionary<Uri, Stream> _aLexicons = new Dictionary<Uri, Stream>();  
 public void AddLexicon(Uri uri, string mediaType, ITtsEngineSite site) {  
    Stream stream = site.LoadResource(uri, mediaType);  
    _aLexicons.Add(uri, stream);  
 public void RemoveLexicon(Uri uri, ITtsEngineSite site) {  
     Stream stream;  
     if (_aLexicons.TryGetValue(uri, out stream)) {  


发音词典是单词或短语的集合,以及使用适当发音字母表指定的发音。A pronunciation lexicon is a collection of words or phrases together with their pronunciations specified using an appropriate pronunciation alphabet.

通常会调用此方法,以响应调用 RemoveLexicon 并使用当前 TtsEngineSsml 实例实现的合成器声音的基于 System.Speech.Synthesis 的应用程序。This method is typically called in response to a System.Speech.Synthesis based applications calling RemoveLexicon and using the synthesizer voice implemented by the current TtsEngineSsml instance.

Notes to Implementers

实现需要完全熟悉,并能够处理 uri上存储的字典。It is the responsibility of the implementation to be fully familiar with and be able to process the lexicon stored at uri. 实现还必须跟踪并管理它删除的所有字典的生存期。The implementation must also keep track and manage the lifetimes of all lexicons it removes.

Applies to