pub fn find_match(
haystack: &[Token],
needle: &[Token],
mode: MatchMode,
permissive: bool,
) -> Option<MatchResult>Expand description
Matches two Vecs of tokens based on MatchMode and returns the first match.
§Parameters
haystack- haystack to seek.needle- needle to match.mode-MatchModeto use for matching. See the enum for more info.permissive- Ifhaystackis more uppercased thanneedle, they will still match.
§Returns
MatchResultif match is found.Noneotherwise.
§Example
use language_tokenizer::{MatchMode, Algorithm, find_match, tokenize};
let haystack = "that's someone who can rizz just like a skibidi! zoomer slang rocks, 67";
let needle = "like a skibidi";
let haystack = tokenize(haystack, Algorithm::English, false).unwrap();
let needle = tokenize(needle, Algorithm::English, false).unwrap();
assert!(find_match(&haystack, &needle, MatchMode::Exact, false).is_some());