private void InitPinyinSearch() { if (_wordsSearch == null) { HashSet <string> allPinYins = new HashSet <string>(); var pys = PinyinDict.PyShow; for (int i = 1; i < pys.Length; i++) { allPinYins.Add(pys[i].ToUpper()); } var wordsSearch = new WordsSearch(); wordsSearch.SetKeywords(allPinYins.ToList()); _wordsSearch = wordsSearch; } }
private WordsSearch getPinYinSplit() { if (_pinyinSplit == null) { _pinyinSplit = new WordsSearch(); List <string> pys = new List <string>(); foreach (var item in PinYinDict.pyName) { var t = item.ToUpper(); if (t.Length < 2) { continue; } pys.Add(t); } _pinyinSplit.SetKeywords(pys); } return(_pinyinSplit); }
private void InitPinyinSearch() { if (_wordsSearch == null) { HashSet <string> allPinyins = new HashSet <string>(); var pys = PinyinDict.PyShow; for (int i = 1; i < pys.Length; i += 2) { var py = pys[i].ToUpper(); for (int j = 1; j <= py.Length; j++) { var key = py.Substring(0, j); allPinyins.Add(key); } } var wordsSearch = new WordsSearch(); wordsSearch.SetKeywords(allPinyins.ToList()); _wordsSearch = wordsSearch; } }