Skip to content

Commit 51c74fe

Browse files
fix bug
1 parent 38537dd commit 51c74fe

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

python/dnlp/data_process/processor.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ def read_dictionary(self, dict_path: str, reverse=False):
2222
else:
2323
return dictionary
2424

25-
def build_dictionary(self, *, content: str = '', files: tuple = (), output_dict_path: str = '',
26-
reverse: bool = False):
27-
if content == '' and files == ():
25+
def build_dictionary(self, *, files: tuple = (), output_dict_path: str = '', reverse: bool = False):
26+
if files == ():
2827
raise Exception('input is none')
2928

30-
chs = set(content)
29+
chs = set('')
3130
file_content = ''
3231
for file in files:
3332
with open(self.base_folder + file, encoding='utf8') as f:
@@ -43,7 +42,7 @@ def build_dictionary(self, *, content: str = '', files: tuple = (), output_dict_
4342
if output_dict_path != '':
4443
with open(output_dict_path, 'w', encoding='utf8') as o_f:
4544
for ch, idx in zip(dictionary.keys(), dictionary.values()):
46-
o_f.write(ch + ' ' + str(idx)+'\n')
45+
o_f.write(ch + ' ' + str(idx) + '\n')
4746
if reverse:
4847
return dictionary, dict(zip(dictionary.values(), dictionary.keys()))
4948
else:

0 commit comments

Comments
 (0)