Function clean_text

Source
pub fn clean_text(s: &str) -> String
Expand description

Function to remove non-alphanumeric characters from a string keeps hyphens due to their usage in abbreviations/medical terms. Also uppercase for standardization. Example:

use drug_extraction_cli::clean_text;

let s = "This is a test-string with 1234 and some punctuation!@#$%^&*()";
let cleaned = clean_text(s);
assert_ne!(cleaned, "THIS IS A TEST STRING WITH 1234 AND SOME PUNCTUATION");
assert_eq!(cleaned, "THIS IS A TEST-STRING WITH 1234 AND SOME PUNCTUATION");