mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-14 03:37:10 +08:00
skip calculation of pinyin score if source string is too long (#1683)
This commit is contained in:
parent
d7da96b387
commit
7fe01f0764
@ -26,9 +26,15 @@ namespace Wox.Infrastructure
|
||||
{
|
||||
if (!string.IsNullOrEmpty(source) && !string.IsNullOrEmpty(target))
|
||||
{
|
||||
FuzzyMatcher matcher = FuzzyMatcher.Create(target);
|
||||
if(source.Length > 40)
|
||||
{
|
||||
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {source}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Alphabet.ContainsChinese(source))
|
||||
{
|
||||
FuzzyMatcher matcher = FuzzyMatcher.Create(target);
|
||||
var combination = Alphabet.PinyinComination(source);
|
||||
var pinyinScore = combination.Select(pinyin => matcher.Evaluate(string.Join("", pinyin)).Score)
|
||||
.Max();
|
||||
|
Loading…
Reference in New Issue
Block a user