Table of Contents

Graph

  1. State the problem

Description

Licencing Currently, there are 3 main software licences used by companies across the world:


_Begin license text._

---

Copyright  

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---

_End license text._

Having research many software licences, I have settled on using the MIT licence for my program. I believe this licence reflects my desires for the use of my program, as I hope that others can take the program and improve on it for their own use. I also believe that if their version of my voice assistant is both unique and helpful for others, that its developers should be able to relicense it.

Resources The program is Python based (Python 3.10), and relies on text files to store data. The program also requires a lot of modules for its basic function:

Modules:

Module Name Purpose Importance
tkinter GUI Design Essential
pyttsx3 Outputting voice Essential
speech_recognition Recognising user input Essential
PIL Getting images Moderate Importance
atexit Running code when script ends Moderate Importance
fileinput Closing text files Low Importance
sys Debugging in console Low Importance
time Getting time for the user log Low Importance
Open Ai Does cool commands for user Essential

There is minimal equipment requirements for the creation and development of this program. I used a relatively high-end Dell XPS-15 and Visual Studio Code for the development of the software. However, I had to install Python 3.10, and also all the modules listed above through PIP installation.

For Visual Studio Code, I had the Pylance and Python modules installed. Pylance offers rich type information, i.e. gave suggestions for minor things for code, e.g. parameters, while the Python module allowed me to run and write the code in Visual Studio Code.

I also used multiple sources of documentation for the various libraries for the program, such as Python Tutorial's website(https://www.pythontutorial.net/tkinter/), Tkinter documentation in Python(https://docs.python.org/3/library/tk.html), the official documentation of pyttsx3(https://pyttsx3.readthedocs.io/en/latest/), etc.

In terms of skills and expertise, I have moderate skills in Python coding. I have a strong understanding of how functions work, which prove incredibly important for managing the structure of the program (having a main function, having a function that takes user voice input, having a function that speaks, etc.). Furthermore, through a strong understanding of lists, dictionaries and the use of text files in Python, I was able to store user data in a text file, and log all user interactions with the program in another file.

I decided to log the actions of the program, as I felt that this would prove quite helpful as a means of gauging errors in the. However, I did not get to be able to log the change in variables present throughout the program, which means the logs will most likely be unhelpful for fixing logic errors.

Visual Studio Code was my main source of testing for the program. Through its debugging menu (F5), I initially worked on the raw main.py file. I did so because when I pressed the Run Python File button, it did not access the text files. Later on while working on the project, I realised that I needed to open the folder the program was in, and from then I started using the Run Python File button, as it was easier to use.

I also used Stack Overflow as a source of advice in using complex/badly-designed modules, such as Tkinter. For example, I initially had a problem with creating a function which would create multiple buttons of the same function, but with different parameters. I had difficulty fixing this issue, as I found that when the program started up, all the buttons were essentially pressed once, and would be unusable after.

for i in accountdata:

        button = ttk.Button(text = str(i))

        button['command'] = finduser(i)

        button.pack()

/* Note that the "finduser" function is a separate function.

However, after looking up this issue with Tkinter on Stack Overflow, I discovered that when Tkinter parses through the 'command' section, it interprets the brackets as calling the function, and immediately calls the function, while incorrectly parsing the function, making it un-callable by the user.

I also learnt from Stack Overflow to instead use Python's lambda functions.

for i in accountdata:

        button = ttk.Button(text = str(i))

        button['command'] = lambda i=i: finduser(i)

        button.pack()

Similar Products (samples)

  1. Plan and Design

Screen Layout Initial Layout:

Turning on the Program:

User Selected

Main Voice Input Section

Graphics

User Interface

Algorithms: Flowcharts

Algorithms: Pseudocode

# Note all the notequal signs are ! + = signs.
BEGIN
Exit <- "False"
# program only breaks when given voice command to
WHILE Exit != "True"
	OUTPUT("Listening")
	INPUT(command)
	# following IF-ELSE statements refers to inbuilt functions
	# note the "What would you like to do?" string is repeated, to indicate to the user the program is repeating.
	IF command == None THEN:
		OUTPUT("Failed to understand, will try again.")
		OUTPUT("What would you like to do?")
	ELIF "obsidian" IN command THEN:
		openObsidian()
		OUTPUT("What would you like to do?")
	ELIF "Firefox" IN command THEN:
		openFirefox()
		OUTPUT("What would you like to do?")
	ELIF "close" IN command THEN:
		closeProgram()
		Exit = "True"
	ELSE:
		# using OpenAI
		key <- "this is a working OpenAI key"
		answer = putThroughOpenAI(key)
		IF answer == None:
			# worst-case scenario, even OpenAi can't make sense of input 
			OUTPUT("OpenAI didn't understand.")
			OUTPUT("What would you like to do?")
		ELSE:
			OUTPUT(answer)
			OUTPUT("What would you like to do?")
END
# Note all the notequal signs are ! + = signs.
BEGIN
INPUT(accountdata)
# data taken from text file and put into list
name <- None
# identifies whether no users
IF len(accountdata) == 0 THEN:
	OUTPUT("No Users Detected")
	# the following lines are the account creation code, simplified 
	INPUT(name)
	accountdata[0] = name
	OUTPUT(name)
# identifies whether only 1 user
ELIF len(accountdata) == 1 THEN:
	name = accountdata[0]
	OUTPUT(name)
# in this case there are multiple users saved
ELSE:
	answer <- "No"
	count <- 0
	# while loop will ask user whether any of the user names saved are the desired one
	WHILE answer != "Yes" OR count == len(accountdata):
		OUTPUT("Is this your name?")
		OUTPUT(accountdata[count])
		INPUT(answer)
		count = count + 1
	IF answer == "Yes" THEN:
	# due to how Python lists work, count - 1 was used
		name = accountdata(count - 1)
		OUTPUT(name)
	ELSE:
		OUTPUT("You chose none of them, let's try again.")
		answer <- "No"
		count <- 0
	# note that there is no feature to directly add an account when accounts exist, in the actual program you must log into someone else's account, and create a new one from there
END
BEGIN
INPUT(accountdata)
# data taken from text file and turned into list
count <- 0
answer <- None
name <- None
# while loop so users have 3 tries inputting name via voice
WHILE count != 3:
	INPUT(nameAudio)
	# recognise.google is a function from a Python module
	answer <- recognise.google(nameAudio)
	IF answer != None THEN:
		name = answer
		count = 3
		# this is done to escape the while loop
	ELSE:
		count = count + 1
IF name == None THEN:
	INPUT(manualName)
	# this is physical input, i.e. typing it
	name = manualName
	# use of "name" variable so that manual and voice naming add to same variable
accountdata.append(name)
# adds name into text file
OUTPUT(name)
END
  1. Test

Trace Table for Voice Commands (bold indicates new sample)

audioInput query program understood openAIKey openAIInput openAIOutput Output
obsidian
"obsidian"
True
openObsidian()
fire fox
"Firefox"
True
openFirefox()
close program please
"close program please"
True
closeProgram()
restart if you want
"restart if you want"
True
restartProgram()
what is 9 times 10
"what is 9 x 10"
False
"valid key"
"what is 9 x 10"
90
90
what is porridge
"what is porridge"
False
"valid key"
"what is porridge"
Porridge is a type of food made by boiling oats or other grains in water or milk. It is usually eaten for breakfast.
Porridge is a type of food made by boiling oats or other grains in water or milk. It is usually eaten for breakfast.
  1. Evaluate

Survey

I have made a brief survey for my voice assistant consisting of 6 rating questions and 4 written questions, which was sent to my fellow peers in my Computer Science class. The following is a summary of the results, obtained from a sample size of 11.

Question 1: "On a scale from one to ten, how organised are you?"

Question 2: "On a scale from one to ten, how important do you think productivity tools are?"

Question 3: On a scale from one to ten, how busy are you, in general?"

Question 4: "On a scale of one to ten, how often do you use a voice assistant?"

Question 5: "On a scale from one to ten, how would you rate my program (any metric)?"

Question 6: "How would you rate the quality of the program's code?"

Question 7: "What do you like about the utility of the program?"

Question 8: "What do you dislike about the utility of the program?"

Question 9: "Do you have any suggestions on improving the program?"

Question 10: "Have you experienced any issues using the program? If so, please list them below."

Here is the link to the survey: https://forms.office.com/r/UTPS0bchCd

Personal Evaluation

Overall, I consider this project to be a success. As someone who has only used raw Python when programming, I felt that having to learn how modules and specifically how GUI modules such as Tkinter work was quite challenging, yet rewarding as I progressed through the task.

However, the task was quite tiring and due to time constraints, I was unable to maintain clarity and conciseness in the source code. I feel that there is quite a lot of inefficiency and redundancy in my source code, such as creating a function for specific windows, however I found this was the only solution at the time due to issues encountered with Tkinter.

I think that while the voice assistant is relatively quite functional, in that it can in fact open specific programs and answer intrinsic questions through OpenAI, due to time constraints I was unable to implement custom functions, which was the main goal of the program. However, the inclusion of OpenAI does make up for this lack of features, as OpenAI's API is quite powerful, and can answer very hard questions such as "What are 3 important things to remember when studying organic chemistry" with responses such as:

1. Organic chemistry is the study of the structure, properties, and reactivity of organic compounds.
2. Organic compounds are molecules that contain carbon atoms.
3. Carbon atoms can form bonds with other carbon atoms, as well as with atoms of other elements.

This detail in responses from OpenAI makes up for some of the lack of functionality, however I do consider my endeavours in creating a voice assistant with substantial utility not as successful as I had hoped.

Furthermore, the following are some limitations I've derived from my program:

However, there are also some good quality of the program:

In summary, I feel that my project was a great effort in working in the shoes of greater voice assistants which were developed with a lot more funding(and incentive). As a result of time constraints, I fell short of the ultimate goal of a successful, well-designed voice assistant, yet the end product has a lot of potential and could be developed into a very user-friendly, intuitive program.