 |


Exercise 33: Unit conversions and dietary informationNovember 5, 2008
Use cases:   | Unit conversions. For example: |
 |   | "Convert X kilograms to pounds" |
 |   | "Convert X kilometers to miles" |
 |   | "Convert X metres to feet" |
  | Alternatively "What is X kilograms in pounds?" or "How many pounds are in X kilograms?" |
  | Support: pounds, kilograms, grams, ounces, metres, feet, inches, feet_and_inches, yards, miles, kilometres, celsius, fahrenheit, kelvin, cups, tablespoons, teaspoons, litres, millilitres, gallons, cubic metres |
  | Dietary information: |
 |   | How many calories are in {quantity} of {food_item}? |
 |  | ex. How many calories are in a can of Pepsi? |
 |   | How many grams of {nutrient} are in {quantity} of {food_item} |
 |  | Nutrient types: carbohydrate, protein, fat |
 |   | Support at least 10 food items. | SolutionClick hereGrace applicationClick here Exercise 32: Large numbersNovember 4, 2008
SummaryImplement a command and control grammar to recognize large numbers so that Grace can be asked things such as "What is five hundred and ninety times forty one"?   | Enhance the voice command syntax to support named rules. For example: |
 | | number_part: {group_of_ten} {digit} |
|
What this says is that a rule named number_part consists of a group_of_ten token followed by a digit token. |
  | Allow rules to be referenced using the following syntax: |
 | Since this overlaps the syntax used to reference an entity type, we will treat entity types as an implicit rule. If there is a rule that uses the same identifier, it will override the entity type. |
Use the large number translations as a basis for the voice command grammar. SolutionIt appears that voice recognition grammar rules can't contain any circular references, so the transformations that I've been using can't be directly adapted. For the time being, I'm using the following: small_number: [{digit} | {teen_number} | {group_of_ten} | {group_of_ten} {digit}] number: [{small_number} | {small_number} {multiplier} | {small_number} {multiplier} (and) {small_number}] |
|
The other issue I ran into is that my approach of enumerating all entity type permutations before trying to parse a phrase isn't scalable past about 6 words. I've bumped into it before, but it's a bit more obvious when dealing with numbers since numbers tend to be very wordy. I think I'll take a crack at trying to rewrite this part of the language parsing algorithm to see whether it is possible to enumerate on the fly. I expect it is, and this approach might make the algorithm scalable up to say 10 words, or it might make it scalable past 15, it's hard to know. Exercise 31: Music, math, and email queriesNovember 2, 2008
Implement the following use cases: 1. | "Play {song_title}", "Play the song {song_title}", and "Play the song {song_title} at {number} percent volume". All of a user's iTunes songs should work. Implement "Pause", "Pause the song", "Resume", "Resume the song". |
2. | "What is X * Y?", "What is X + Y?". For now, only implement math for numbers between 1 and 19 since command and control voice recognition won't recognize larger numbers by default. |
3. | "Ask Meredith when she'll be home". Send a pre-formatted email to Meredith asking her when she'll be home, and use a return email address of "grace.bigham@gmail.com". Check the Gmail account once every minute for a reply. If the email is replied to, speak the response. | SolutionClick hereolder >>
|
|
|
|
|
 |