use std::collections::HashMap;
fn known_name_to_symbol_map() -> HashMap<&'static str, &'static str> {
HashMap::from([
("ather", "ATHERENERG"),
("tata motors", "TATAMOTORS"),
("reliance", "RELIANCE"),
("infosys", "INFY"),
("infy", "INFY"),
("hdfc bank", "HDFCBANK"),
("icici bank", "ICICIBANK"),
("sbi", "SBIN"),
("hcl", "HCLTECH"),
("maruti", "MARUTI"),
("l&t", "LT"),
("paytm", "PAYTM"),
("nykaa", "NYKAA"),
("ola", "OLAELEC"),
("mahindra", "M&M"),
("zomato", "ETERNAL"),
("suven", "COHANCE")
])
}
pub fn match_symbol_from_query(query: &str) -> String {
let lower_query = query.to_lowercase();
for (name, symbol) in known_name_to_symbol_map() {
if lower_query.contains(name) {
return symbol.to_string();
}
}
query.to_string()
}