mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Stop using singular for normalization
This commit is contained in:
parent
9022503e76
commit
bb092212ac
@ -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 {
|
pub fn normalize_name(name: &str) -> String {
|
||||||
let parts: Vec<&str> = name.split_whitespace().collect();
|
let parts: Vec<&str> = name.split_whitespace().collect();
|
||||||
if parts.len() >= 2 {
|
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
|
// NOTE(jwall): The below unwrap is safe because of the length
|
||||||
// check above.
|
// check above.
|
||||||
let last = parts.last().unwrap();
|
let last = parts.last().unwrap();
|
||||||
let normalized = last.to_singular();
|
|
||||||
prefix.push(' ');
|
prefix.push(' ');
|
||||||
prefix.push_str(&normalized);
|
prefix.push_str(&last.to_string());
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
return name.trim().to_lowercase().to_owned();
|
return name.trim().to_lowercase().to_owned();
|
||||||
|
@ -302,7 +302,7 @@ fn test_ingredient_parse() {
|
|||||||
(
|
(
|
||||||
"1 can baked beans",
|
"1 can baked beans",
|
||||||
Ingredient::new(
|
Ingredient::new(
|
||||||
"baked bean",
|
"baked beans",
|
||||||
None,
|
None,
|
||||||
Package("can".into(), Quantity::Whole(1)),
|
Package("can".into(), Quantity::Whole(1)),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user