forked from robinreni96/ChatBot-Using-NLTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataload.py
57 lines (44 loc) · 1.12 KB
/
dataload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 9 14:56:18 2017
@author: robinreni
"""
import pandas as pd
blogdata= pd.read_csv("techcrunch.csv")
global column
column=[]
column=blogdata.columns.tolist()
global wholelist
wholelist={}
for i in column:
wholelist[i]=blogdata[i].values.tolist()
global catt
catt=[]
global content
content=[]
def checkcontent(con):
name=[]
l=[]
for i in con:
for j in column:
l=wholelist[j]
for k in range(len(l)):
string=str(l[k])
name=string.strip().split()
if i in name:
print("BOT>> ",blogdata.loc[k,catt[0]])
return("BOT>> Content Displayed")
else:
return("Sorry The Required Content is not avilable")
def result(content_list):
if content_list[0]=='show':
content_list.remove('show')
elif content_list[0]=='Show':
content_list.remove('Show')
for i in content_list:
if i in column:
catt.append(i)
content_list.remove(i)
result=checkcontent(content_list)
return(result)