diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2020-11-07 18:25:28 +0100 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2020-11-07 18:25:28 +0100 |
| commit | 5f5e855af2473bf5ff12ecac296dad37b5d923ac (patch) | |
| tree | ff99477b52673ce33d69ba2f3b21c9990db511a0 /src/common | |
| parent | 6ec424ed8d34cf8a5f51e277a20429741b33ee96 (diff) | |
started on fuzzy searching on the naive indexer.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/fuzzy.odin | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/common/fuzzy.odin b/src/common/fuzzy.odin new file mode 100644 index 0000000..4a03c45 --- /dev/null +++ b/src/common/fuzzy.odin @@ -0,0 +1,24 @@ +package common + + +FuzzyMatcher :: struct { + pattern: string, +}; + +make_fuzzy_matcher :: proc (pattern: string) -> FuzzyMatcher { + return FuzzyMatcher { + pattern = pattern + }; +} + +fuzzy_match :: proc (matcher: FuzzyMatcher, match: string) -> f64 { + + //temp just look at the beginning on the character - will need to learn about fuzzy matching first. + + if matcher.pattern[0] == match[0] { + return 1.0; + } + + + return 0.0; +} |