File size: 522 Bytes
32ca76b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import _pickle as pickle  # python3
import time
import json


def read_pickle(filepath):
    f = open(filepath, 'rb')
    word2mfccs = pickle.load(f)
    f.close()
    return word2mfccs


def save_pickle(save_path, save_data):
    f = open(save_path, 'wb')
    pickle.dump(save_data, f)
    f.close()


def read_json(filepath):
    with open(filepath) as f:
        obj = json.load(f)
    return obj


def save_json(save_path, obj):
    with open(save_path, 'w') as f:
        json.dump(obj, f)