Stop using singular for normalization

This commit is contained in:
Jeremy Wall 2024-01-03 15:26:33 -05:00
parent 9022503e76
commit bb092212ac
2 changed files with 2 additions and 5 deletions

View File

@ -419,8 +419,6 @@ pub fn measure(i: StrIter) -> abortable_parser::Result<StrIter, Measure> {
}
}
// TODO(jwall): I think this is a mistake. We should rethink what noralizing means or we should
// remove it.
pub fn normalize_name(name: &str) -> String {
let parts: Vec<&str> = name.split_whitespace().collect();
if parts.len() >= 2 {
@ -428,9 +426,8 @@ pub fn normalize_name(name: &str) -> String {
// NOTE(jwall): The below unwrap is safe because of the length
// check above.
let last = parts.last().unwrap();
let normalized = last.to_singular();
prefix.push(' ');
prefix.push_str(&normalized);
prefix.push_str(&last.to_string());
return prefix;
}
return name.trim().to_lowercase().to_owned();

View File

@ -302,7 +302,7 @@ fn test_ingredient_parse() {
(
"1 can baked beans",
Ingredient::new(
"baked bean",
"baked beans",
None,
Package("can".into(), Quantity::Whole(1)),
),