Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python language only use NLP , semantic search function Smartphones use voice recognition and NLP techniques to allow users to issue commands with their voice.

Python language only use NLP , semantic search function

Smartphones use voice recognition and NLP techniques to allow users to issue commands with their voice. An important task is to match the vocal command with the right app. For example, if the command is "Call my doctor", the phone should open the app to make phone calls; if the command is "water the plants", the phone should open the app that manages the irrigation system, etc

The goal of this assignment is to implement a function that takes command as input (e.g., "Call my doctor") and returns the name of the app to open. Given a list of apps and their description, the function you will implement will use a semantic search engine to match the command to the description that is semantically closest.

Your goal is to implement the logic of the choose_app function, which takes a command as input and returns the name of the App that best matches the command among those listed in the DataFrame df (Slack, Open Table, Phone by Google, etc). For example, the command "make a reservation for two for tonight at 6 pm at my favorite restaurant" should return "Open Table". Your code must be based on semantic search.

Coding starts here : ( Python notebook , NLP , use semantic search only )

import pandas as pd

df = pd.read_csv('apps.csv',index_col=0)

df

def choose_app(command): # return the most relevant app most_relevant_app = return most_relevant_app

Test

Use this code to test your function. The function I implemented matches every command correctly.

# list of potential commands that a user may give voice_commands = [ 'water the plants in the backyard', 'set an alarm for 30 minutes from now', 'show me the battery of the motion detection device in the living room', 'call the doctor', 'send a message to my boss', 'make a reservation for two for tonight at 6 pm at my favorite restaurant', 'how long was the hike I did yesterday?' ]

# for each command, find the best matching app for command in voice_commands: print(f'COMMAND = {command}') print(f'APP TO OPEN = {choose_app(command)} ')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

11. Are your speaking notes helpful and effective?

Answered: 1 week ago

Question

The Goals of Informative Speaking Topics for Informative

Answered: 1 week ago