Implementation

After creating the data structure of tabular format mentioned above we will be calculating the predicted answer to a question every time a user queries our bot. We load all the question answers pair from the dataset. Let's load our CSV file using pandas and perform some pre-processing on the dataset:

Code Link: https://github.com/PacktPublishing/Python-Deep-Learning-Projects/tree/master/Chapter4/tfidf_version
import pandas as pd

filepath = 'sample_data.csv'
csv_reader=pd.read_csv(filepath)

question_list = csv_reader[csv_reader.columns[0]].values.tolist()
answers_list = csv_reader[csv_reader.columns[1]].values.tolist()

query= 'Can I get an Americano, btw how much it will cost ?'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.70.38