main.c contains the main loop and some utility functions. It prompts the user to type in a question, gathers the response, and divides it into words. You should not need to modify this file.
implements the behaviour of the chatbot. It is required to:
- Identify the intent and entity in each line of input from the user.
- If the intent is an instruction, carry it out.
- If the intent is a question, search the knowledge base (see below) for an answer.
- If the knowledge base does not contain an answer, ask the user for an answer, and add the new answer to the knowledge base.
implements the chatbot’s knowledge base, as described in the next section. For each question intent understood by the chatbot, the knowledge base should support
- Searching the knowledge base for an answer corresponding to the entity in the question.
- Adding a new entity with a corresponding answer to the question.
- Erasing the existing entities and answers.
- Implement a preliminary version of knowledge_get()
- returns a few hard-coded responses to questions, and implement chatbot_is_question() and
- chatbot_do_question() to use it.
- Implement knowledge_put() so that you can add new entities to the knowledge base and
- re-implement knowledge_get() to retrieve these entities
- Modify chatbot_do_question() so that it asks the user for new knowledge whenever the user asks a question that is not in the knowledge base.
- Implement chatbot_do_reset() so that it erases all of the knowledge created by knowledge_put(). The main function resets the chatbot at the beginning of the program, and again whenever the user issues the RESET intent.
- Implement chatbot_do_save() and chatbot_do_load().