Search your (large) documents in seconds
Back in May 2017, I was in the exam period of my 3rd year at college. A good preparation required me to go through many assignments and quizzes and answer multiple choice or open questions. Most of the answers were often found in the lecturer’s notes. So, I found myself reading tens of pages multiple times, only to find the exactly correct answer somewhere in the notes. And I was not the only one doing this.
That experience made me wonder: Is there a more effective way?
Fast-forward a couple of months, I decided to kick off my Artificial Intelligence journey. I started learning how some of the most powerful state-of-the-art algorithms work and, eventually, began documenting my knowledge in a weekly blog.
Seeing the rapid improvement in deep learning and natural language processing, I decided to solve the problem that many students face during their college days.
Armed with my recent learnings and passion to create valuable products, I built Asknote.
How does it work?
Asknote is a web application which lets you find the answers you need within any document. Here is how it works:
#1. Enter your email
First, you need to enter your email.
It is used both when you add files and ask questions. This way the system authorizes you, delivering only answers based on your own documents.
Important: always keep your email in the field. Otherwise, you will receive an error message.
#2. Upload your PDF file
Next you need to add a PDF file of your choice. Just click Choose File, followed by Upload PDF file.
Important: after uploading the file, wait until you receive a success message on the screen. Then, you will be sure your document was processed successfully.
#3. Ask your question
After accomplishing the above steps, just fill in your question and click Ask.
You are supposed to enter a question for which you expect the answer to be hidden somewhere in the documents.
You will receive the top 5 most relevant answers with their associated page number and file name. This way you can write down the correctly predicted result and read only the respective page.
Iterate over step #2 and #3 as many times as you wish. Your answers will be extracted after a careful analysis of all files.
How it was made?
Great! Now you fully understand how to use Asknote.
In this section, I want to share with you some insights on the process involved in building this application.
#1. Answer anything
The very first challenge I faced was how to predict an answer based on a given passage and a question.
I immediately dived into an extensive research to find out the most recent AI improvements in this field. I came across an amazing leaderboard which lists all algorithms. Essentially, each one of them takes a question and a passage, represented as vectors, and outputs the start and end position of the answer.
Due to similarities in their implementation, I decided to first understand the math behind them. This led me to write an article, explaining the best model.
For Asknote, I chose to go with the second best model (by Allen Institute for Artificial Intelligence) because its performance is excellent for the use case.
#2. Let’s do files, not text
So far so good! I was receiving the correct answers and the system was working. But, as a student, I didn’t imagine myself coping and pasting chunks of texts to search for an answer. Millennials, like me, can get really impatient when dealing with technology, so everything needs to happen fast and with no more than 2–3 actions.
The process needed to be simpler.
To do so, I introduced PDF uploads. The system accepts your files and analysis them to deliver the best results in the end. I wanted a reliable and stable solution, so I spent a decent amount of time perfecting the backend to perform the operations concurrently. That improved the file upload experience significantly.
There are still some drawbacks which I want to point out. I did my best to avoid them but, I guess, they will remain for version 0.1:
- Currently, you are able to add only PDF files. Any other format will be rejected. (I am planning on supporting Word docs, webpages or images in the upcoming weeks)
- You can upload a single file at a time. For multiple, just do them one by one. (Don’t worry, your answers will be search amongst all of the files)
- Images with text, within a PDF, won’t be processed. This means that you can’t find answers based on the information inside the photos.
- Large files (100+ pages) may sometimes take longer (5–15 sec). (I know this is sometimes annoying so I will work on improvement in the next version)
#3. Different users
I had the idea of different users at the start of the project, but didn’t know how exactly to execute it. I felt no need of a whole authentication process, because it would be an additional step before experiencing the core functionality.
Instead, I decided to require an email to distinguish between different users. The email serves as your unique key, so when search for an answer only your documents are being displayed. This makes it possible for you to ask any question anytime, even if you reload or close the page.
#4. Answers design
Since the project leverages a fresh new deep learning technique, which was introduced just a couple of months ago (thus it hasn’t gone through many iterations), one can sometimes be dissatisfied with the accuracy of the end result.
My solution is to navigate the user towards the right prediction but leave him to choose the answer himself. Instead of presenting the prediction with the highest probability, the system shows the top 5 most relevant answers together with their associated page number and document name.
Let’s work together
With my recent improvements in the field of Artificial Intelligence I came to realize that a collaboration between machines and humans can result in an immense increase in our total productivity — the power which determines economic growth.
Asknote perfectly illustrates that partnership.
The AI system simplifies one’s search by providing several recommendations, leaving the human to make the final decision. That results in solving complex problems such as answering any question in a matter of seconds.
The project benefits me a lot. I hope you also find it useful. Excited to hear your thoughts.