diff --git a/TODO.md b/TODO.md index 10f8b2ddf0..1c1ab6fe92 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,9 @@ Audio - No more missing phonemes Cleanup + - Refactor into a very well-defined "SpeakRequest" with all + parameters, including new ones like "is_twitter", + "missing_word_mode = slience, record_pop, umm", etc. - Remove old query parameters - Set default volume diff --git a/dictionary/NEEDED.md b/dictionary/NEEDED.md index 5747c71e5f..79e13812ea 100644 --- a/dictionary/NEEDED.md +++ b/dictionary/NEEDED.md @@ -1,8 +1,10 @@ These words aren't in the dictionary ------------------------------------ ++ (plus symbol) banjo-tooie charizard crafted +fearmongers ganon ganondorf gorp diff --git a/src/lang/parser.rs b/src/lang/parser.rs index 8766bc516c..3c2a309019 100644 --- a/src/lang/parser.rs +++ b/src/lang/parser.rs @@ -85,7 +85,8 @@ impl Parser { match *v { Symbol::Ampersand => sentence.push("and".to_string()), Symbol::AtSign => sentence.push("at".to_string()), - Symbol::Percent => sentence.push("percent".to_string()), + Symbol::Percent => sentence.push("percent".to_string()), + Symbol::Plus => sentence.push("plus".to_string()), Symbol::GreaterThan => { sentence.push("greater".to_string()); sentence.push("than".to_string()); diff --git a/src/lang/token.rs b/src/lang/token.rs index e56fcc77e2..3f3c35aebd 100644 --- a/src/lang/token.rs +++ b/src/lang/token.rs @@ -78,6 +78,7 @@ pub enum Symbol { GreaterThan, LessThan, Percent, + Plus, } #[derive(Clone, PartialEq)] @@ -212,6 +213,10 @@ impl Token { Token::Punctuation { value: Punctuation::Period } } + pub fn plus() -> Token { + Token::Symbol { value: Symbol::Plus } + } + pub fn question() -> Token { Token::Punctuation { value: Punctuation::Question } } diff --git a/src/lang/tokenizer.rs b/src/lang/tokenizer.rs index 5b47004977..809d226da8 100644 --- a/src/lang/tokenizer.rs +++ b/src/lang/tokenizer.rs @@ -147,6 +147,7 @@ impl Tokenizer { } // Symbols + // FIXME: Map lookup for speedup. if unknown == "@" { output.push_back(Token::at_sign()); continue; @@ -162,6 +163,9 @@ impl Tokenizer { } else if unknown == ">" { output.push_back(Token::greater_than()); continue; + } else if unknown == "+" { + output.push_back(Token::plus()); + continue; } // Match hashtags. @@ -707,6 +711,22 @@ mod tests { assert_eq!(expected, result); } + #[test] + fn test_symbols() { + let t = make_tokenizer(); + + let result = t.tokenize("& < > + % @"); + let expected = vec![ + Token::ampersand(), + Token::less_than(), + Token::greater_than(), + Token::plus(), + Token::percent(), + Token::at_sign(), + ]; + assert_eq!(expected, result); + } + #[test] fn test_percent_symbol() { let t = make_tokenizer();