-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilterword.py
34 lines (25 loc) · 874 Bytes
/
filterword.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
from xlrd import open_workbook
import pandas as pd
import numpy as np
import csv
import collections
dataset = pd.read_csv('level6 + syllable + word family.csv')# The respective file names
ftCol = dataset.iloc[:, 0].values
print("enter")
book = open_workbook("badwordlist.xlsx")# badword dataset
array=[]
def badword(word):
result = 0 #if 0 the word good else any value bad
for sheet in book.sheets():
for rowidx in range(sheet.nrows):
row = sheet.row(rowidx)
for colidx, cell in enumerate(row):
if cell.value == word :
for j in range(1):
result = rowidx
return result
print(ftCol)
var = len(ftCol)
print("Calling function")
array.append([badword(i) for i in ftCol])
print(array)