Monday, October 17, 2016

A Slightly Useful Product

Last weekend, I was able to spend a lot of time on Academist. I completed the first thing on my to-do list from last post, which was to make a basic search algorithm to find Khan Academy topics and videos based on keywords that may appear in assignments.

The end result is that Academist will successfully display links to relevant Khan Academy pages for an assignment titled "Study for Quiz on Circular/Gravity," and it will know what type of Khan Academy resources they are (It says "Watch" if a video, "Study" if a broader topic, etc.). Luckily, I had this assignment on my list so that I could test Academist against a real assignment, instead of creating fake ones. Here is proof of it working:

Academist will automatically display the top five results using the search algorithm. This all came together thanks to a lot of intricate parts.
First, there was the database of Khan Academy topics. I stuck with only math and science to keep things simple, and I re-created the XML (discussed on 9/19) to include the type of resource for each Khan Academy page. I then had to parse that XML file in JavaScript and translate the data from the file into a JavaScript array.

The next part is the search algorithm. Of course, search algorithms are a widely useful tools that are used all over the place, so I wasn't going to reinvent the wheel. I just had to download a JavaScript library for a search algorithm, and I found one called "lunr." This library allowed me to input a query to search in a list, which in this case was list of all the math and science topics on Khan Academy. It was able to find similar, yet not exact matches, and also ignored common words such as "the." One thing that I did do myself was filter out common words that teachers post in assignments that would get in the way of searching for a topic, such as "study" and "quiz."

Those were the two most important parts, but I also had to learn how to format HTML elements, how to create a hyperlink with JavaScript, how to read local files in a Chrome Extension, and the list goes on. There are endless technical details that are involved in this project, but for the average non-computer-programmer, a picture of the code that makes Academist work might give you the gist of what I am working with:

No comments:

Post a Comment