Skip to content

Commit

Permalink
also support --min-token-length in suffix array mode
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Jul 3, 2024
1 parent 460a668 commit 6c71f79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 6c71f79

Please sign in to comment.