Esempio n. 1
0
        private bool MatchProgram(ControlPanelItem item, FuzzyMatcher matcher)
        {
            if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString).Score) > 0) return true;
            if (item.InfoTip != null && (item.Score = matcher.Evaluate(item.InfoTip).Score) > 0) return true;

            if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString.Unidecode()).Score) > 0) return true;

            return false;
        }
Esempio n. 2
0
File: Main.cs Progetto: zzjeric/Wox
        private int Score(ControlPanelItem item, string query)
        {
            var scores = new List <int>();

            if (item.LocalizedString != null)
            {
                var score1 = StringMatcher.Score(item.LocalizedString, query);
                var socre2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
                scores.Add(Math.Max(score1, socre2));
            }
            if (item.InfoTip != null)
            {
                // todo should we add pinyin score for infotip also?
                var score = StringMatcher.Score(item.InfoTip, query);
                scores.Add(score);
            }
            return(scores.Max());
        }
Esempio n. 3
0
        private bool MatchProgram(ControlPanelItem item, string query)
        {
            if (item.LocalizedString != null && (item.Score = StringMatcher.Match(item.LocalizedString, query)) > 0)
            {
                return(true);
            }
            if (item.InfoTip != null && (item.Score = StringMatcher.Match(item.InfoTip, query)) > 0)
            {
                return(true);
            }

            if (item.LocalizedString != null && (item.Score = StringMatcher.Match(item.LocalizedString.Unidecode(), query)) > 0)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        private bool MatchProgram(ControlPanelItem item, FuzzyMatcher matcher)
        {
            if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString).Score) > 0)
            {
                return(true);
            }
            if (item.InfoTip != null && (item.Score = matcher.Evaluate(item.InfoTip).Score) > 0)
            {
                return(true);
            }

            if (item.LocalizedString != null && (item.Score = matcher.Evaluate(item.LocalizedString.Unidecode()).Score) > 0)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 5
0
        private int Score(ControlPanelItem item, string query)
        {
            var scores = new List <int> {
                0
            };

            if (string.IsNullOrEmpty(item.LocalizedString))
            {
                var score1 = StringMatcher.Score(item.LocalizedString, query);
                var score2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
                scores.Add(score1);
                scores.Add(score2);
            }
            if (!string.IsNullOrEmpty(item.InfoTip))
            {
                var score1 = StringMatcher.Score(item.InfoTip, query);
                var score2 = StringMatcher.ScoreForPinyin(item.InfoTip, query);
                scores.Add(score1);
                scores.Add(score2);
            }
            return(scores.Max());
        }
Esempio n. 6
0
        private int Score(ControlPanelItem item, string query)
        {
            var scores = new List <int> {
                0
            };

            if (!string.IsNullOrEmpty(item.LocalizedString))
            {
                var score1 = StringMatcher.FuzzySearch(query, item.LocalizedString).ScoreAfterSearchPrecisionFilter();
                var score2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
                scores.Add(score1);
                scores.Add(score2);
            }
            if (!string.IsNullOrEmpty(item.InfoTip))
            {
                var score1 = StringMatcher.FuzzySearch(query, item.InfoTip).ScoreAfterSearchPrecisionFilter();
                var score2 = StringMatcher.ScoreForPinyin(item.InfoTip, query);
                scores.Add(score1);
                scores.Add(score2);
            }
            return(scores.Max());
        }
Esempio n. 7
0
 private int Score(ControlPanelItem item, string query)
 {
     var scores = new List<int>();
     if (item.LocalizedString != null)
     {
         var score1 = StringMatcher.Score(item.LocalizedString, query);
         var socre2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
         scores.Add(Math.Max(score1, socre2));
     }
     if (item.InfoTip != null)
     {
         // todo should we add pinyin score for infotip also?
         var score = StringMatcher.Score(item.InfoTip, query);
         scores.Add(score);
     }
     return scores.Max();
 }
Esempio n. 8
0
 private int Score(ControlPanelItem item, string query)
 {
     var scores = new List<int> {0};
     if (string.IsNullOrEmpty(item.LocalizedString))
     {
         var score1 = StringMatcher.Score(item.LocalizedString, query);
         var score2 = StringMatcher.ScoreForPinyin(item.LocalizedString, query);
         scores.Add(score1);
         scores.Add(score2);
     }
     if (!string.IsNullOrEmpty(item.InfoTip))
     {
         var score1 = StringMatcher.Score(item.InfoTip, query);
         var score2 = StringMatcher.ScoreForPinyin(item.InfoTip, query);
         scores.Add(score1);
         scores.Add(score2);
     }
     return scores.Max();
 }
Esempio n. 9
0
        private bool MatchProgram(ControlPanelItem item, string query)
        {
            if (item.LocalizedString != null && (item.Score = StringMatcher.Match(item.LocalizedString, query)) > 0) return true;
            if (item.InfoTip != null && (item.Score = StringMatcher.Match(item.InfoTip, query)) > 0) return true;

            if (item.LocalizedString != null && (item.Score = StringMatcher.Match(item.LocalizedString.Unidecode(), query)) > 0) return true;

            return false;
        }