From 574eff0df1aff9bdc6d32939a03312cc08803de3 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Mon, 17 Apr 2023 23:43:05 +0100 Subject: Add --matching-algorithm option. This replaces the --fuzzy-match algorithm. Available choices are normal, prefix and fuzzy. Levenshtein distance was investigated, but it seems pretty rubbish for tofi's use case, where you normally want a good match when you've only typed a small portion of the target string. --- src/matching.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/matching.h (limited to 'src/matching.h') diff --git a/src/matching.h b/src/matching.h new file mode 100644 index 0000000..f619804 --- /dev/null +++ b/src/matching.h @@ -0,0 +1,14 @@ +#ifndef MATCHING_H +#define MATCHING_H + +#include + +enum matching_algorithm { + MATCHING_ALGORITHM_NORMAL, + MATCHING_ALGORITHM_PREFIX, + MATCHING_ALGORITHM_FUZZY +}; + +int32_t match_words(enum matching_algorithm algorithm, const char *restrict patterns, const char *restrict str); + +#endif /* MATCHING_H */ -- cgit v1.2.3