use wana_kana::{ConvertJapanese, IsJapaneseStr}; pub fn lookup(input: &str) -> Option<&jisho::Entry> { let input = input.trim(); jisho::lookup(input).into_iter().find(|&word| ( // If input has no kanji, // we can just compare the input to the reading verbatim // ensuring both are hiragana (input.is_kana() && input.to_hiragana() == word.reading.to_hiragana()) || // Otherwise, we have to ensure that the input // is verbosely the same. // However, this will cause problems for some words. // For example, 照り焼き will be accepted but 照焼 won't. (input == word.kanji))) }