-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_feature_path.py
executable file
·45 lines (37 loc) · 1.25 KB
/
clean_feature_path.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from pathlib import Path, PurePath
from time import time, sleep
import os
import argparse
import gc
gc.enable()
pathname = 'features0'
np.set_printoptions(threshold=np.inf)
filelist = []
for filename in Path(pathname).glob('**/*.files'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.bh'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.mfcc'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.mfcckl'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.rp'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.rh'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.chroma'):
filelist.append(filename)
for filename in Path(pathname).glob('**/*.notes'):
filelist.append(filename)
for myfile in filelist:
with open(str(PurePath(myfile)), 'r') as file :
filedata = file.read()
filedata = filedata.replace("/beegfs/ja62lel/fma_full/", "")
filedata = filedata.replace("/beegfs/ja62lel/private/", "")
# Write the file out again
with open(str(PurePath(myfile)), 'w') as file:
file.write(filedata)
print str(PurePath(myfile))