new method: jieba.disable_parallel, which is the inverse operation of jieba.enable_parallel

pull/39/head
fxsjy 12 years ago
parent b46166f768
commit 3f003e2f29

2
.gitignore vendored

@ -161,3 +161,5 @@ pip-log.txt
# Mac crap
.DS_Store
*.log

@ -252,3 +252,10 @@ def enable_parallel(processnum):
cut = pcut
cut_for_search = pcut_for_search
def disable_parallel():
global pool,cut,cut_for_search
if pool != None:
pool.close()
pool = None
cut = __ref_cut
cut_for_search = __ref_cut_for_search

@ -151,7 +151,7 @@ def __lcut_internal(sentence):
return list(__cut_internal(sentence))
def cut(sentence):
if not hasattr(jieba,'pool'):
if (not hasattr(jieba,'pool')) or (jieba.pool==None):
for w in __cut_internal(sentence):
yield w
else:

Loading…
Cancel
Save