-
Notifications
You must be signed in to change notification settings - Fork 0
/
sfx_plain.py
25 lines (19 loc) · 867 Bytes
/
sfx_plain.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
import unicodecsv
with open('data/sfx_data.csv') as f:
pairs = [(row['id'],row['tags'].lower()) for row in unicodecsv.DictReader(f)]
with open('data/sfx_tags.txt','w') as f:
for id,tags in pairs:
line = id + ' ' + tags + '\n'
f.write(line.encode('utf8'))
with open('data/sfx_data.csv') as f:
pairs = [(row['id'],row['description'].replace('\n', ' ').replace('\r', ' ').lower()) for row in unicodecsv.DictReader(f)]
with open('data/sfx_descriptions.txt','w') as f:
for id,desc in pairs:
line = id + ' ' + desc + '\n'
f.write(line.encode('utf8'))
with open('data/sfx_data.csv') as f:
pairs = [(row['id'],row['preview-hq-mp3'].lower()) for row in unicodecsv.DictReader(f)]
with open('data/sfx_mp3.txt','w') as f:
for id,url in pairs:
line = id + ' ' + url + '\n'
f.write(line.encode('utf8'))