/// ------------------------------------------------------------------------------------ /// <summary> /// Determines whether or not the specified phone is one of the tone letters. /// </summary> /// ------------------------------------------------------------------------------------ public IPASymbol ToneLetterInfo(string phone) { IPASymbol charInfo; return(ToneLetters != null && ToneLetters.TryGetValue(phone, out charInfo) ? charInfo : null); }
/// ------------------------------------------------------------------------------------ public void LoadFromList(List <IPASymbol> list) { if (list == null || list.Count == 0) { return; } Clear(); if (ToneLetters != null) { ToneLetters.Clear(); } // Copy the items from the list to the "real" cache. foreach (var info in list) { this[info.Decimal] = info; // If the code point is less than zero it means the character is // made up of multiple code points and is one of the tone letters. // In that case, make sure to add the character to the list of // tone letters. if (info.Decimal < 0) { if (ToneLetters == null) { ToneLetters = new Dictionary <string, IPASymbol>(); } ToneLetters[info.Literal] = info; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the IPA character information for the specified IPA character (in string /// form). This is mainly for the Chao tone letters which should be the only symbols /// that contain more than one codepoint. /// </summary> /// ------------------------------------------------------------------------------------ public IPASymbol this[string ipaCharStr] { get { if (string.IsNullOrEmpty(ipaCharStr)) { return(null); } IPASymbol charInfo; if (ToneLetters != null && ToneLetters.TryGetValue(ipaCharStr, out charInfo)) { return(charInfo); } return(Values.FirstOrDefault(symbolInfo => symbolInfo.Literal == ipaCharStr)); } }