Skip to content

Commit

Permalink
Merge pull request #43 from derRiesenOtter/master
Browse files Browse the repository at this point in the history
Bug fix for missing first letters of words
  • Loading branch information
derRiesenOtter authored Dec 19, 2023
2 parents 484e60f + 8c90d1c commit 9a5d8fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ lazy_static! {
(
// Deletes multiple occurrences of words using the extended fancy-regex crate
// syntax. Only the first mention of a word occurring multiple times is retained:
fancy_regex::Regex::new(r"(?i)\b(?P<first>\b\w+\b)(?P<spacer>.*)\b\k<first>").unwrap(),
fancy_regex::Regex::new(r"(?i)\b(?P<first>\b\w+\b)(?P<spacer>.*)\b\k<first>\b").unwrap(),
r"$first$spacer".to_string()
)
);
Expand Down
12 changes: 12 additions & 0 deletions src/model_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,18 @@ mod tests {
Some(&(*CAPTURE_REPLACE_DESCRIPTION_PAIRS))
)
);

// Test 8 also checks that no additional letters are deleted
hit_words = "sp|Q6R2K2|SRF4_ARATH P Transferase Domain Containing Protein OS=Arabidopsis thaliana OX=3702 GN=SRF4 PE=2 SV=1".to_string();
expected = "p transferase domain containing protein";
assert_eq!(
expected,
filter_stitle(
&hit_words,
&(*FILTER_REGEXS),
Some(&(*CAPTURE_REPLACE_DESCRIPTION_PAIRS))
)
);


}
Expand Down

0 comments on commit 9a5d8fe

Please sign in to comment.