Skip to content

Commit 9d98d26

Browse files
committed
added log into Alphabet service since it can induce a large perf hit
1 parent dcb9e34 commit 9d98d26

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Wox.Infrastructure/Alphabet.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ public static bool ContainsChinese(string word)
117117
return false;
118118
}
119119

120+
if (word.Length > 40)
121+
{
122+
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {word}");
123+
return false;
124+
}
125+
120126
var chinese = word.Select(PinyinHelper.toHanyuPinyinStringArray)
121127
.Any(p => p != null);
122128
return chinese;

Wox.Infrastructure/StringMatcher.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ public static int ScoreForPinyin(string source, string target)
131131
{
132132
if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target))
133133
{
134-
if(source.Length > 40)
135-
{
136-
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {source}");
137-
return 0;
138-
}
139-
140134
if (Alphabet.ContainsChinese(source))
141135
{
142136
var combination = Alphabet.PinyinComination(source);

0 commit comments

Comments
 (0)