mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
Merge branch 'master' of https://github.com/fxsjy/jieba
This commit is contained in:
commit
689e27280a
@ -295,8 +295,10 @@ def __lcut_all(sentence):
|
|||||||
def __lcut_for_search(sentence):
|
def __lcut_for_search(sentence):
|
||||||
return list(__ref_cut_for_search(sentence))
|
return list(__ref_cut_for_search(sentence))
|
||||||
|
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
@require_initialized
|
@require_initialized
|
||||||
def enable_parallel(processnum):
|
def enable_parallel(processnum=multiprocessing.cpu_count()):
|
||||||
global pool,cut,cut_for_search
|
global pool,cut,cut_for_search
|
||||||
if os.name=='nt':
|
if os.name=='nt':
|
||||||
raise Exception("jieba: parallel mode only supports posix system")
|
raise Exception("jieba: parallel mode only supports posix system")
|
||||||
|
@ -3,7 +3,8 @@ import sys,time
|
|||||||
import sys
|
import sys
|
||||||
sys.path.append("../../")
|
sys.path.append("../../")
|
||||||
import jieba
|
import jieba
|
||||||
jieba.enable_parallel(4)
|
|
||||||
|
jieba.enable_parallel()
|
||||||
|
|
||||||
url = sys.argv[1]
|
url = sys.argv[1]
|
||||||
content = open(url,"rb").read()
|
content = open(url,"rb").read()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user