2021-06-17 01:55:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Spencer Dixon <spencercdixon@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-04-16 20:01:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
|
|
|
|
namespace AK {
|
2021-06-17 01:55:44 +00:00
|
|
|
|
2022-04-16 20:01:20 +00:00
|
|
|
struct FuzzyMatchResult {
|
|
|
|
bool matched { false };
|
|
|
|
int score { 0 };
|
|
|
|
};
|
2021-06-17 01:55:44 +00:00
|
|
|
|
2022-09-13 21:23:55 +00:00
|
|
|
FuzzyMatchResult fuzzy_match_recursive(String const& needle, String const& haystack, size_t needle_idx, size_t haystack_idx,
|
|
|
|
u8 const* src_matches, u8* matches, int next_match, int& recursion_count);
|
2021-06-17 01:55:44 +00:00
|
|
|
|
2022-09-13 21:23:55 +00:00
|
|
|
FuzzyMatchResult fuzzy_match(String const& needle, String const& haystack);
|
2021-06-17 01:55:44 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-04-16 20:01:20 +00:00
|
|
|
using AK::fuzzy_match;
|
|
|
|
using AK::FuzzyMatchResult;
|