-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfilter.py
More file actions
30 lines (26 loc) · 782 Bytes
/
filter.py
File metadata and controls
30 lines (26 loc) · 782 Bytes
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
#Filter for game titles to remove NSFW content
def filter_titles(fn):
FILTER_LIST = ['18+', 'sex', 'fuck', 'hentai', 'dick', 'shit', 'cock', 'cum']
with open(fn, 'r', encoding='utf-8') as f:
data = f.readlines()
for i in range(len(data)):
data[i] = data[i].lower()
print(data[i])
l = []
for d in data:
for f in FILTER_LIST:
if f not in d:
l.append([d])
break
x = []
for d in data:
for f in FILTER_LIST:
if f in d:
x.append([d])
break
print(len(x))
print(len(l))
with open('filtered.txt', 'w', encoding='utf-8') as f:
for i in l:
f.write(i[0])
filter_titles("id_mappings.txt")