Add a Word doc upload function to our plugin that recognizes quiz questions and loads them into our existing quiz builder. Attached is a sample doc. This is the worst-case scenario. If it works here, it will work every time.
1. Project Goal
The goal of this project is allow users to upload word doc quizzes into our existing quiz builder. Right now questions and answers must be copied over manually. This must be done using our existing custom WP plugin.
The first task will be to build a custom file upload button. This is where the user should upload the their current word document test.
Next will be to parse through the uploaded file and identify questions. There will be 3 types of questions you need to account for: Mutiple Choice, Short Answer, and True/False. Of course we will not be able to handle every test, we would like to cover most cases.
These assumptions might help you build the plugin
Assume that questions will be a number format (1, 2, 3). This number will be followed by either a ‘.’ or a ‘)’.
Assume that numbers are sequential in order
Assume that multiple choice questions will have answers (a, b, c, d, e…). This letter will be followed by either a ‘.’ or a ‘)’. Assume letter are sequential in order.
Assume that a True/False question will contain both the words True and False
Assume that a short answer questions will be any questions that don’t contain the strings “True”, “False”, or the character ‘a. b. c’.
You can implement the plugin any way that works. However I have some ideas that might help you. You could parse each question/answers into a block of text by looking at the number format. Then search each block for keywords. Such as looking for true/false, “a., b., c.”. This should help you determine what type of question it is. You may also use the “?” character to identify questions.