TtsEngineSsml.AddLexicon(Uri, String, ITtsEngineSite) TtsEngineSsml.AddLexicon(Uri, String, ITtsEngineSite) TtsEngineSsml.AddLexicon(Uri, String, ITtsEngineSite) Method


將語彙加入至目前的 TtsEngineSsml 執行個體所實作的 SynthesizerVoiceAdds a lexicon to the SynthesizerVoice implemented by the current TtsEngineSsml instance.

 abstract void AddLexicon(Uri ^ uri, System::String ^ mediaType, System::Speech::Synthesis::TtsEngine::ITtsEngineSite ^ site);
public abstract void AddLexicon (Uri uri, string mediaType, System.Speech.Synthesis.TtsEngine.ITtsEngineSite site);
abstract member AddLexicon : Uri * string * System.Speech.Synthesis.TtsEngine.ITtsEngineSite -> unit


Uri Uri Uri

System.Uri的有效執行個體,指出詞典資訊的位置。A valid instance of System.Uri indicating the location of the lexicon information.

String String String

字串,包含字典的媒體類型。A string containing the media type of the lexicon. 媒體類型不區分大小寫。Media types are case insensitive.

ITtsEngineSite ITtsEngineSite ITtsEngineSite

用來與平台基礎結構互動的ITtsEngineSite介面參考。A reference to an ITtsEngineSite interface used to interact with the platform infrastructure.


的執行AddLexicon會使用傳入ITtsEngineSite的介面, 從資源載入字典。The implementation of AddLexicon uses the ITtsEngineSite interface passed in to load a lexicon from a resource. 然後, 它會System.IO.Stream將儲存至以字典System.Collections.Generic.Dictionary URI 編制索引的實例中的字典。It then stores a System.IO.Stream to the lexicon in a System.Collections.Generic.Dictionary instance, indexed by the lexicon URI.

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.

這個方法通常會由平臺基礎結構呼叫, 以回應System.Speech.Synthesis呼叫AddLexicon的應用程式, 並使用目前TtsEngineSsml實例所執行的合成器語音。This method is typically called by the platform infrastructure in response to a System.Speech.Synthesis based applications calling AddLexicon and using the synthesizer voice implemented by the current TtsEngineSsml instance.

的值mediaType通常是 mime 規格, 因為 SSML 規格會使用 mime 作為媒體規格。The value of mediaType is typically a MIME specification, as the SSML specification uses MIME for media specifications.


這是完全熟悉的實作為責任, 而且能夠處理儲存于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 adds.