File tree 2 files changed +20
-10
lines changed
2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change 28
28
root .withdraw () # 隐藏主界面
29
29
30
30
_path = askdirectory ()
31
- config .update ({'mdict_path' : [_path ]})
32
- print ('mdict_path' , _path )
31
+ # 如果用户点击取消和关闭选择框,返回值都是空字符串。
32
+ if _path != '' :
33
+ config .update ({'mdict_path' : [_path ]})
34
+ print ('mdict_path' , _path )
35
+ else :
36
+ print ('mdict_path is empty.' )
33
37
_path = askdirectory ()
34
- # 如果用户关闭了选择框,那么返回值是什么?
35
- config .update ({'audio_path' : [_path ]})
36
- print ('audio_path' , _path )
38
+ if _path != '' :
39
+ config .update ({'audio_path' : [_path ]})
40
+ print ('audio_path' , _path )
41
+ else :
42
+ print ('audio_path is empty.' )
37
43
else :
38
44
if mdict_path != '' :
39
45
config .update ({'mdict_path' : [mdict_path ]})
46
+ print ('mdict_path' , mdict_path )
47
+ else :
48
+ print ('mdict_path is empty. require -m parameter, use -h to show help.' )
49
+
40
50
if audio_path != '' :
41
51
config .update ({'audio_path' : [audio_path ]})
42
-
43
- if mdict_path == '' and audio_path == '' :
44
- print ('require -m or -a parameter, use -h to show help .' )
52
+ print ( 'audio_path' , audio_path )
53
+ else :
54
+ print ('audio_path is empty .' )
45
55
46
56
47
57
def write_json_file (con , file , mode = 'w' ):
Original file line number Diff line number Diff line change 3
3
import re
4
4
5
5
from django .db .models .functions import Length
6
- from nltk .data import path as nltk_path
7
- from nltk .stem import WordNetLemmatizer
8
6
from spellchecker import SpellChecker
9
7
10
8
from base .base_utils import ROOT_DIR
28
26
# thpool = create_thread_pool()
29
27
30
28
try :
29
+ from nltk .data import path as nltk_path
30
+ from nltk .stem import WordNetLemmatizer
31
31
nltk_path .append (os .path .join (ROOT_DIR , 'media' , 'nltk_data' ))
32
32
lemmatizer = WordNetLemmatizer ()
33
33
lemmatizer .lemmatize ('a' )
You can’t perform that action at this time.
0 commit comments