-
Notifications
You must be signed in to change notification settings - Fork 14
4. Queries
Nala uses an intent loop to understand what a query is from a user. First, a user states a wake word - (1) in this case, “Hey Nala” (2) - which then triggers a response from Nala - (3) in this case, “How can I help you?.” Then, a user provides another query (usually after some beeping sound) - such as (4) “I’d like the weather.” Nala transcribes this query to understand it, and parses the query for keyword intents; for example, if the response is “I’d like the weather” the only word that really matters is “weather” and that would be used to provoke a response (5). Then, after this keyword maps onto an action dictionary (or a map of responses to keywords), the action is executed (6). Then, the intent loop repeats itself, looking for another wakeword (“Hey Nala”) before triggering another action.
This architecture is quite powerful.
You can use the "AND" statement to query multiple intents. For example, instead of saying just “get the weather” we could say “get the weather AND sleep.” First, the weather will be fetched via weather.py and then Nala will go to sleep (usually for 30 minutes). This allows for a rich array of possible queries.
You can disable multi-query capability by setting it to FALSE in the SETTINGS.json file (in settings section of this wiki). I find this feature useful when I have a lot to do in a short period of time.
Note the picture above can be viewed as a video if you click on it, which demonstrates this multi-query capability.
Here are some actions that Nala can currently do along with the query intents needed to activate them. If you have any other ideas, let us know on the github issues tab (as an enhancement)!
Action | Description | Example query intent |
---|---|---|
⏰ alarm.py | Plays an alarm sound (e.g. to wake up in morning) based on the time of day you specified during user registration. | “set alarm”, “stop alarm” |
🎵 chillout.py | Plays music in the background to help you calm down. | “chill out” |
🏟️ espn.py | Scrapes ESPN website to find any events going on later tonight. This is a work-in-progress. | “get sports” |
🎴 events.py | Scrape meetup.com for events in your local area. | “find events” |
📜 generate_poem.py | Generate a poem based on the generate poetry script we wrote a while back. | “make a poem” |
📝 grateful.py | Helps you keep a gratitude journal by recording a sample of what you’re grateful for today. | “be grateful” |
Plays back a joke from the database. | “make a joke” | |
🌅 meditation.py | Guides you through a simple 60 second meditation. | “meditate” |
🎧 music.py | YouTube music links - based on a genre. | “play music” |
📰 news.py | searches some basic news sites related to computer science and machine learning (e.g. Hacker News). | “grab the news” |
🍐 nutrition.py | Searches for some healthy food nearby | “be healthy” |
Schedules a trip in terms of AirBnB suggestions and flights | “plan trip” | |
↪️ reboot.py | Restarts the computer. | “restart” |
🔍 search.py | search bing with a query. | First query: “search”, Second query: [search term] |
⌛ shutdown.py | Shuts down the computer. | “shut down” |
😴 sleep | Puts the computer to sleep for a designated time period. | ‘go to sleep’ |
👥 social.py | Alternative script to give you some suggestions based on your budget to go out later. | ‘be social’ |
🌡️ weather.py | Searches weather.com for the current weather at your location. | ‘get the weather’ |
☕🍦🎉🍺 yelp.py | Based on the query, searches yelp for coffee, restaurants, food, nightlife, ice cream, or bars. | ‘get me coffee’, ‘get me some food’, ‘nightlife’, ‘get ice cream’, ‘grab beer’ |