Thursday, June 30, 2016

6/30

More of the same! Trying to get my Dynamo to work. It's not writing to the table as it should be but I'm sure I'll find the mistake eventually.

Wednesday, June 29, 2016

6/29

I've finished re-organizing and integrating all the DynamoDB things but of course it isn't working... I'm trying to find tutorials and forums about Dynamo with Alexa skills but it's not heavily documented. The only place I can find an in depth one is on the Amazon GitHub with Java tutorials, but like I learned at the beginning of this project, those are vague, out-dated, and don't work very well. Hopefully I'll find a second source soon.

Tuesday, June 28, 2016

6/28

Today I started adding all the DynamoDb code into my existing skill. This is requiring me to re-organize my existing code and change more than I thought, but I made a good start and have a clear idea of where to go.

Monday, June 27, 2016

6/27

Today I spent a lot of time thinking about the most user friendly way to save session state. There's a built in and straight forward way of remembering the session within my code, but whenever Alexa times out, it'll wipe the current session. I think I'll end up using DynamoDB (which I had initially thought I would use). This way, when a user asks to make a certain recipe, I can have all the ingredient and direction data save to a new table. Even if the User spends 30 minutes on one step, they'll be able to ask for the next step. If Alexa has timed out, I'll have her start by asking if they would like to continue with the recipe currently in Dynamo, of if they would like to start over.

It might take a little while to get everything working with Dynamo, but all the forums I've been reading have said that this is definitely the way to go.

Friday, June 24, 2016

6/24

After cleaning my project, I couldn't get my uploaded package to recognize my recipe and url file anymore. Although there are countless stack overflow forums on this, it took me hours to get it working! I spent forever going over different solutions, different ways to try importing the file, different ways to attach it to my pom.xml, different places to put the file, etc. I'm going to upload these changes to github and hopefully it'll work for more than just me!

EDIT: I went through and tested what change actually made it work. I had properly included the resource, I just wasn't reading form it properly. I had previously accessed it by using

InputStream is = RecipeSetup.class.getResourceAsStream("MASTER_RECIPE.txt"); but this did not work. I think it's because I was supposed to use a getClass method on my main function, but I wasn't calling it from main. Instead, I needed to get the classLoader using:

ClassLoader loader = Thread.currentThread().getContextClassLoader();

InputStream is = loader.getResourceAsStream("MASTER_RECIPE.txt");

Thursday, June 23, 2016

6/23

I spent a good chunk of today trying to figure out why David can't get my code to find recipes but I have no idea what could be wrong... I'm finding it's pretty difficult to fix a problem that I can't replicate myself!

I started to look at the Alexa samples which saved state using Dynamo or S3 and I'll start integrating this into my code soon. I had the thought that I wanted to make sure everything was completely user friendly before doing this, but after making cookies using my application, I'm convinced that the only way to make it user friendly is to save state.

I got so bored of asking "recipehelper" and specifying the recipe "urban legend chocolate chip cookies" with every single request. Sometimes, I would mess up the title or jumble the whole request and Alexa would get confused- which got annoying after the fifth time it happened.  I was surprised at how well asking about quantity of ingredients worked (except butter, which kept messing up) but asking for specific steps was a challenge as Alexa kept hearing the wrong number.

I now have 50 delicious cookies and have better insight into how to make my app better! hooray!

Wednesday, June 22, 2016

6/22

Today I worked on the bugs with Alexa trying to find my recipe titles. I'm having a lot of weird issues and despite going through and heavily processing the files (to ensure there were no symbols, numbers, and to make sure that it matched the slot recipe names exactly) Alexa still isn't finding some of them. I also have made sure to convert everything to lower case. When searching "chinese style baby bok choy" it says that it wasn't found in the map (created from the text file) but if you search "bok choy" it will return the correct recipe. I'll continue working on this interesting problem.


EDIT: After "cleaning" my files in Eclipse, it's working!

Tuesday, June 21, 2016

6/21

I didn't work on my project today but I did fill out the Google Summer of Code midterm evaluation! I'll be back to working tomorrow morning.

Monday, June 20, 2016

6/20 STAGE 2 COMPLETE

Another huge milestone completed!
I have all of my intents working with my entire list of recipes (not just one hard coded one). All new code and resources uploaded to GitHub

There's still plenty to do, however. I need to add in all sorts of fuzzy searching for ingredients. For example, when I ask about how much 'milk' I need for Pancakes (which is explicitly listed in the recipe) it responds with "you need 1 cup of milk", but asking about 'whole milk' responds "You don't need whole milk for this recipe". I would like to at least have it respond "I couldn't find whole milk, but you need 1 cup of milk" if not automatically responding about milk in general.

I also have been testing random recipes from my slot list and some of them aren't working. I'll have to look into this. As ironic as it is, I couldn't get any of my chocolate chip cookie recipes to respond, since the name usually has weird variations (Anna's Chocolate Chip cookies, Nestle Chocolate Chip Cookies I, etc). I'll probably implement the same fuzzy searching that will be used for ingredients.

In the next few days I'm also going to test out the skill by having my Alexa assist me in cooking so I know what I need to fix about the user experience.

And, of course, I'll work on saving the current session so the steps and ingredients can be read in order with the users prompting and without repeating the current recipe title.

Sunday, June 19, 2016

6/19

Came across a pretty large problem today when realizing that I needed to create a "slot" object for all my ingredients. This was easy when I had only one chocolate chip cookie recipe, but now I'll have to go through and get all the ingredients for each recipe, process the list to remove any numbers, symbols, measurement words, etc, remove duplicates, and create my slot object this way.

I did 10 pages of each category to create my ingredient slot and I'm pretty sure this should be a big enough range for every possible ingredient. If I come across problems I can always widen that later on.

I'll also have to use some sort of selection strategy and have Alexa use fuzzy searching around the ingredient slot since not all of them are perfect. For example, a few ingredients are 'bottle salad dressing',  'limes juiced', etc. However, if the user says "limes", I'm hoping that Alexa will be able to search within my specific recipe's ingredients for anything with lime or juice. This could create some problems later on, but this was the best solution I could think of for dealing with this problem.

Saturday, June 18, 2016

6/18

Today I remembered that in order for my file to be uploaded with my text file, I need to add it as a resource in Maven. After this I had to read up on opening text files from resources, reading from input streams, etc. Alexa still isn't finding my text file and isn't working right, but when I look at it next I hope I catch a simple to fix mistake that I've been overlooking during all these changes.

Friday, June 17, 2016

6/17

I had a weird day full of out of the ordinary activities and was unable to work today! However, I'll try to work and blog tomorrow.

Thursday, June 16, 2016

6/16

Today, I continued to work on adapting my existing code for the new recipe selection. It's not working through the Alexa yet, but I have two of the four 'features' working locally (when I pass in the "intent"). I can't figure out why it isn't working through the Alexa but I'm sure I'll figure it out tomorrow.

Wednesday, June 15, 2016

6/15

As I mentioned last night in my edit, I uploaded all my code and my recipe files! I also created a file with just the recipe titles and processed it to get rid of all symbols and punctuation so AWS would accept it as a slot. The rest of today was spent working adapting my code to start working for multiple recipes instead of just the chocolate chip cookie.

Tuesday, June 14, 2016

6/14


After spending hours scraping the same page over and over again (such a dumb mistake), I decided in the end to use multi threading! I officially have my master recipe file in a .txt that is properly formatted for the next steps. I'll push the code and files to github later tonight and tomorrow I think I should have Alexa giving recipe directions for any recipe on my 311 page list! Hoorah!

Edit: I've now uploaded both the individual category files, the code for the processing, and the master recipe file to my GitHub. I also re-processed to delete duplicates (recipe name ii, recipe name iii, etc) which Alexa would not have been able to process.

Monday, June 13, 2016

6/13

As I write this post, my computer is slowly processing 30 pages of recipes from each category. It's taken way longer than I could have imagined going through each recipe to grab the title and URL but It continues to add more and more recipes. It took me a while to set up the proper try/catch blocks for each new URL change and to get rid of the HTML errors. I thought about using multi-threading to speed this up, but since my internet has been very touchy in the past, I figured that slow and steady was the way to go. I'm pretty sure by the end of the day I'll have my list of all recipes and their URL's. From here, I'll add the new slot type to the Alexa and with a few tweaking, should have it working if a complete title for any specific recipe is given.

Friday, June 10, 2016

6/10

Today I wrote all the logic for going through all the categories, going through 30 pages of each recipe within each category, and then getting the title and complete recipe URL and writing it to a map and then to a text file. I also wrote the logic for going in and grabbing each ingredient, direction, etc. Once the error goes away, everything should work and I should be very close to my second milestone!

Thursday, June 9, 2016

6/9

I didn't get a lot done today since I've still been getting those errors, but I plan on working through that issue with my brother this weekend. I worked on organizational things, such as getting the code that will write the map, the text file, the objects etc, ready for when those errors go away.

Wednesday, June 8, 2016

6/8

Today I got a lot done but have also started to get stuck. My initial problem this morning was that the recipes were being double counted (each recipe link would print multiple times in a row to the output .txt file). I fixed this by creating a map of my recipe names and URL's, but then I started to get weird error messages and timeouts.

The most common error I'm getting is an IOException about too many redirects from HTTPConnectionResponse. I didn't change my code too much from this morning when everything was working, so I'm pretty confused. I found this stack overflow forum about it, but I'm not sure how to use this to fix my own code, as I'm not explicitly using HTTP. I'm hoping this is more of an internet issue that will disappear tomorrow.

I've decided to cap the recipes I use at 25-30 pages of recipes per category. If I ever stop getting runtime errors, I'll go through all of them, add it to a map, and then print the map keys to a text file. This text file will be used to help build my slots and intent schema. Then, whenever the program is re-run, I simply need to re create a map from the text file. When someone passes in a recipe intent, I'll find that recipe in the map, go to the URL, and create the ingredient, step, and recipe object that are needed for my skill.

Tuesday, June 7, 2016

6/7

Got Jsoup working within AllRecipes and have successfully navigated through the categories to the recipes within!

I also have it working within each recipes to grab the title, ingredients, and directions.

I'm not sure it's grabbing all the recipes however, I think my computer might be timing out or it's only taking the recipes that are on the first pre loaded page. I'll keep playing around with this.

I'll also take a look into hRecipe, although I'm hoping it's something that I'll be able to integrate into what I already have, since I've gotten this working relativley well.

Later tonight and tomorrow I'm going to start building recipe, ingredient, and step objects and continue to make sure each recipe is grabbed.

Monday, June 6, 2016

6/6

Today, I've continued working on web scraping. I discovered that the github I was going to reference was 4 years old and didn't work on AllRecipes anymore. I'm going to keep it as a reference for organization, however. I also decided to use AllRecipes.com instead of Epicurious, since Epicurious had too many ads, unrelated links, and JavaScript that were interfering with navigation.

I've been looking at tutorials on using Jsoup with Java. The most helpful was this one which allowed me to successfully grab the name and URL for each category on AllRecipes. However, I got stuck when trying to navigate within each category. I posted a comment on his page and will talk to my brother tonight about advice on how to proceed.

I'm sure problems will arise this week with formatting, splitting ingredients, getting the proper names, etc. but after spending a few days on it, I'm sure things will come together. I'm also starting to think about how I'll let the user know what recipes they can choose from. Maybe later in the process I'll start to integrate the app features more so I can list all the available recipes.

Once I successfully scrape the recipes, I think more progress will quickly come.

Thursday, June 2, 2016

6/2

Today, I started looking into different programs for scraping websites for recipes. I think I've decided on using Jsoup and began looking at different tutorials and guides. This one will help me with the first few steps. I also found a github that used Java, Eclipse, and Jsoup to scrape for recipes. Although they used the information for a Google spreadsheet, it'll still be a good reference for setting up the parsing.

Wednesday, June 1, 2016

6/1 STAGE 1 COMPLETE

I have a complete skill running through Alexa! If anyone wants to test it, I've uploaded the code and steps to test it through AWS https://github.com/hpedskis/google-summer-of-code

Some Issues still:
-It's not completely user friendly. If you ask how to make cookies, it just reads through all the steps. You can specifically ask "what is step 1", etc, but I'm eventually hoping for a "to hear the next step, say next" output.
-I haven't taken the time to write out enough sample utterances (there is a very limited way you can ask for each step)
-Not all bugs are worked out, for example, if you ask about sugar, it only answers about the quantity of brown sugar instead of regular sugar. This is because I haven't found a good way to split up the ingredient name and quantity yet, so I'm simply doing a .contains search in each ingredient line.

Today I worked on getting all the intents working, working with slots, and then creating a detailed read me! Hooray!