From 6c71f796f7c004d56fff05b7d2e8e278b64108cc Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Wed, 3 Jul 2024 11:57:08 +0200 Subject: [PATCH] also support --min-token-length in suffix array mode --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8fee5a1..d008ae2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,7 +153,7 @@ fn main() { .required(false)) .arg(Arg::with_name("min-token-length") .long("min-token-length") - .help("Minimum token length to consider, shorter tokens will be ignored and not matched (applies only to --tokens, --coverage and --coverage-matrix)") + .help("Minimum token length to consider, shorter tokens will be ignored and not matched") .takes_value(true) .default_value("1") .required(false)) @@ -421,6 +421,9 @@ fn main() { eprintln!("Searching..."); for (lexicon, lexiconname) in lexicons.iter().zip(lexiconnames.iter()) { for entry in lexicon.iter() { + if min_token_length >= 1 && entry.chars().count() < min_token_length { + continue; + } let matches = suffixtable.positions(entry); let length = entry.as_bytes().len() as u32;