-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathscore_match.h
More file actions
28 lines (25 loc) · 806 Bytes
/
Copy pathscore_match.h
File metadata and controls
28 lines (25 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <cstddef>
#include <vector>
struct MatchOptions {
bool case_sensitive;
bool smart_case;
size_t max_gap;
};
/**
* Returns a matching score between 0-1.
* 0 represents no match at all, while 1 is a perfect match.
* See implementation for scoring details.
*
* If options.case_sensitive is false, haystack_lower and
* needle_lower must be provided.
*
* If match_indexes is non-null, the optimal match index in haystack
* will be computed for each value in needle (when score is non-zero).
*/
float score_match(const char *haystack,
const char *haystack_lower,
const char *needle,
const char *needle_lower,
const MatchOptions &options,
std::vector<int> *match_indexes = nullptr);