Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
finnbear committed Dec 9, 2023
1 parent d3d962c commit 956f205
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 313 deletions.
1 change: 1 addition & 0 deletions src/dictionary_extra.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ braig
brain cell
braincell
brauer
brazilian s
btw it
cheese nips
chonkey
Expand Down
21 changes: 20 additions & 1 deletion src/false_positive_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,26 @@ fn main() {

progress.finish();

let mut sorted: Vec<_> = false_positives.into_inner().unwrap().into_iter().collect();
let mut false_positives = false_positives.into_inner().unwrap();

let clone = false_positives.clone();
false_positives.retain(|false_positive| {
let baseline = is_ignore_fp(false_positive.chars(), true);
for clone in &clone {
if false_positive.len() != clone.len()
&& (false_positive.starts_with(clone) || false_positive.ends_with(clone))
{
let shorter = is_ignore_fp(clone.chars(), true);
if baseline == shorter {
println!("filter out {false_positive} in favor of {clone}");
return false;
}
}
}
true
});

let mut sorted: Vec<_> = false_positives.into_iter().collect();
sorted.sort();

fs::write("src/false_positives.txt", sorted.join("\n")).unwrap();
Expand Down
Loading

0 comments on commit 956f205

Please sign in to comment.