Question: Q 1 . Corpus - Based Chatbot: Code [ 1 0 ] In this task, you will learn to implement the corpus - based chatbot
Q CorpusBased Chatbot: Code
In this task, you will learn to implement the corpusbased chatbot using a retrieval approach.
Use the NPS chat dataset from NLTK and load the sentences using nltk corpus.npschat.posts
From the sentences, discard all the sentences which are questions. You may use re package to find all the sentences starting with words like 'what', 'why', 'when', 'where', is 'how', do 'does', 'which', 'are', 'could', 'would', 'should', 'has', 'have', 'whom', 'whose', and 'don't'. Also, remove the sentences with lengths less than or equal to unless the sentence contains words like 'hello', hi 'greetings', 'what's up and 'hey'.
Using the TFIDF vectorization implemented in assignment calculate the TFIDF vectors for the sentences.
Write a method to calculate the cosine similarity of a vector with all the documents and return the document with the highest similarity score.
Build a chatbot by iteratively taking the user input, converting it to a TFIDF vector, and finding and displaying the most similar document using the cosine similarity of the vector with all documents in the corpus.
Written: Explore the chatbot with your own input. Specify inputs you provided and output generated from the chatbot and give your analysis based on the following criteria:
Engagingness: On a scale of how much did you enjoy talking to the chatbot?
Making sense: On the following scale how often did the chatbot say something which did NOT make sense?
a Never made any sense
b Most responses didn't make sense
c Some responses didn't make sense
d Everything made perfect sense
Avoiding Repetition: On the following scale how repetitive was the chatbot?
a Repeated themselves over and over
b Sometimes said the same thing twice
c Always said something new
Fluency: On a scale of how fluent were the responses of the chatbot grammatical correctness, clarity, readability
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
