Ejemplo n.º 1
0
        public static int ScoreForPinyinOrEng(string source, string target)
        {
            if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target))
            {
                if (source.Length > 40)
                {
                    Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {source}");
                    return(0);
                }

                if (Alphabet.ContainsChinese(source))
                {
                    var matcher     = FuzzyMatcher.Create(target);
                    var combination = Alphabet.PinyinComination(source);

                    return(matcher.Evaluate(combination).Score);
                }

                return(Score(source, target));
            }

            return(0);
        }
Ejemplo n.º 2
0
 public void init()
 {
     pinYinName = Alphabet.PinyinComination(fileName);
 }