2019-09-29 12:26:15 +08:00
|
|
|
|
using System;
|
2014-02-09 00:33:10 +08:00
|
|
|
|
|
|
|
|
|
namespace Wox.Infrastructure
|
|
|
|
|
{
|
2019-09-29 12:26:15 +08:00
|
|
|
|
[Obsolete("This class is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")]
|
2014-02-09 00:33:10 +08:00
|
|
|
|
public class FuzzyMatcher
|
|
|
|
|
{
|
2014-03-24 21:14:10 +08:00
|
|
|
|
private string query;
|
|
|
|
|
private MatchOption opt;
|
2014-02-09 00:33:10 +08:00
|
|
|
|
|
2014-03-24 21:14:10 +08:00
|
|
|
|
private FuzzyMatcher(string query, MatchOption opt)
|
2014-02-09 00:33:10 +08:00
|
|
|
|
{
|
2014-03-24 21:14:10 +08:00
|
|
|
|
this.query = query.Trim();
|
|
|
|
|
this.opt = opt;
|
2014-02-09 00:33:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-24 21:14:10 +08:00
|
|
|
|
public static FuzzyMatcher Create(string query)
|
2014-02-09 00:33:10 +08:00
|
|
|
|
{
|
2019-10-17 18:37:09 +08:00
|
|
|
|
return new FuzzyMatcher(query, StringMatcher.EmptyMatchOption);
|
2014-02-09 00:33:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-24 21:14:10 +08:00
|
|
|
|
public static FuzzyMatcher Create(string query, MatchOption opt)
|
2014-02-09 00:33:10 +08:00
|
|
|
|
{
|
2014-03-24 21:14:10 +08:00
|
|
|
|
return new FuzzyMatcher(query, opt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MatchResult Evaluate(string str)
|
|
|
|
|
{
|
2019-09-29 12:26:15 +08:00
|
|
|
|
return StringMatcher.FuzzySearch(query, str, opt);
|
2014-02-09 00:33:10 +08:00
|
|
|
|
}
|
2014-03-24 21:14:10 +08:00
|
|
|
|
}
|
2014-02-09 00:33:10 +08:00
|
|
|
|
}
|