pub(crate) const MEMORY_STORE_STRICT_PHRASES: &[&str] = &[
"remember that",
"remember my",
"remember i",
"remember these",
"remember this",
"remember the following",
"note that",
"note my",
"note these",
"note this",
"save that",
"save these",
"save this",
"store these",
"store this",
"store that",
"keep in mind",
"keep track of",
"don't forget",
"do not forget",
"memorize",
"learn that",
"learn this",
"record that",
"record this",
"update my",
];
pub(crate) const MEMORY_STORE_LENIENT_VERBS: &[&str] = &["remember", "memorize", "store", "save"];
pub(crate) const MEMORY_STORE_FACT_CONTEXTS: &[&str] = &[
"facts about me",
"things about me",
"info about me",
"information about me",
"details about me",
];
pub(crate) const SCHEDULING_VERB_PHRASES: &[&str] = &[
"schedule",
"remind me",
"set a reminder",
"alert me",
"notify me",
"ping me",
"wake me",
];
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn strict_phrases_share_root_verbs_with_lenient_verbs() {
let lenient: std::collections::HashSet<&str> =
MEMORY_STORE_LENIENT_VERBS.iter().copied().collect();
let expected_lenient_gaps: std::collections::HashSet<&str> =
["note", "keep", "don't", "do", "learn", "record", "update"]
.into_iter()
.collect();
for phrase in MEMORY_STORE_STRICT_PHRASES {
let first_word = phrase.split_whitespace().next().unwrap_or("");
assert!(
lenient.contains(first_word) || expected_lenient_gaps.contains(first_word),
"strict phrase {phrase:?} has root verb {first_word:?} that is \
neither in MEMORY_STORE_LENIENT_VERBS nor in the documented \
gap list — add it to one or the other"
);
}
}
#[test]
fn no_empty_keyword_entries() {
for kw in MEMORY_STORE_STRICT_PHRASES
.iter()
.chain(MEMORY_STORE_LENIENT_VERBS.iter())
.chain(MEMORY_STORE_FACT_CONTEXTS.iter())
.chain(SCHEDULING_VERB_PHRASES.iter())
{
assert!(!kw.is_empty(), "empty keyword constant");
assert_eq!(
*kw,
kw.to_ascii_lowercase(),
"keyword {kw:?} must be lowercase"
);
assert_eq!(
*kw,
kw.trim(),
"keyword {kw:?} has leading/trailing whitespace"
);
}
}
}