File size: 463 Bytes
6fc394f
dcd73d9
6fc394f
dcd73d9
 
6fc394f
dcd73d9
 
6fc394f
 
 
dcd73d9
 
6fc394f
dcd73d9
 
6fc394f
 
dcd73d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import json
import string


def save_dict(file_path, data_dict, encoding='utf-8'):
    with open(file_path, "w", encoding=encoding) as f:
        json.dump(data_dict, f, ensure_ascii=False)


def load_dict(file_path):
    with open(file_path, "r", encoding='utf-8') as f:
        data_dict = json.load(f)
    return data_dict


def read_file(file_path):
    with open(file_path, "r", encoding="utf-8") as f:
        sentences = f.readlines()
    return sentences