Final Week — Reflection

Roshni Samuel
Design with code
Published in
4 min readAug 21, 2018

Roshni Rebecca Samuel — Coding Process

The initial draft was very basic and surface level but the task is to find the error and systematically evaluate the task at hand. The first draft I created looked like this. It was simple with the variables starting the ‘Greetings’ with random.choice and ‘response’ listing out the items. I started by listing out two variables of locations (N5) and (N5) and attaching the strings to the designated campus based on the location.

The next step was to add a variable for devices that were in both locations. That was the only difference made in the second draft.

The one error I noticed off the bat was that even if I typed in a piece of equipment that was not in the list I only got the ‘Sorry can’t find the equipment’, The ‘None of the equipment available’ response never appeared. It was because I wrote the ‘if’ statement wrong. The right statement would be
‘if input_count<1:’ then it would work. Meaning if the availability of the input is less than 1 then the statement will work.

So as a result I had to take the next step because at this point there is no complete for loop so I decided to assign the variables jp=1 to create multiple For Loops. I added more equipment to the list.

The only problem I had was that when the bot asks you “Do you want to look for some more equipment? Type Y or N” and the user responds with N. It goes all the way back to the random.choice Greetings rather than the list question.

I was also able to print the list so as to create a comprehensive list of equipment displayed in front of the user. Using \n I was able to list it out. In this draft I was also able to address the issue of removing the case sensitivity. From the user side I was able to make the program no longer case sensitive with the function [response=response.upper()] and I typed all of the strings in uppercase so that the response is automatically converted to uppercase for the program to be able to read it.

From the facilitator’s side one of the important things was to add more comments to the program so that it can be a step by step walk through of the program.

Another suggestion from the facilitator was to add smarter variable names such as instead of ‘response’ label it ‘equipment’ that could be more suggestive and easier to understand. I was able to figure out a way to convert text to speech using the ‘say’ command inbuilt into Mac. By typing in ‘from os import system’ that immediately imports the text to speech feature that exists on Mac. The sequence ‘system(‘say ……’)’ and print(“…..”) this will dictate as well as simultaneously print out what you would want it to say.

I was able to implement error tolerance by using the sequence matcher the program was able to recognise similar strings and ask ‘Did you mean this…?’. Using the command subprocess.call(‘say My name is %s and I am at your service’ %(name),shell=True)

Using the simil=similar(item,l) this implements the error tolerance into the function. In the ‘if’ statement if (1>simil>.4) gives the range of how tolerant or typo sensitive the program will appear to be. The final program is user friendly and fault tolerant. Doubtless it could be improved in various directions especially implementing ASR but for a first effort it feels like a success. I worked through the process of coding it by myself and I’m going to continue my pursuit to further improve the program.

--

--