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