From 1dbc525dfff9bbae106015fcfb9ed8c388149d01 Mon Sep 17 00:00:00 2001 From: Linker Lin Date: Sun, 28 Jul 2013 00:10:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=A3=80=E6=B5=8BCPU?= =?UTF-8?q?=E6=95=B0=E7=9B=AE=EF=BC=8C=E5=90=AF=E5=8A=A8=E5=90=88=E9=80=82?= =?UTF-8?q?=E6=95=B0=E7=9B=AE=E7=9A=84=E8=BF=9B=E7=A8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jieba/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jieba/__init__.py b/jieba/__init__.py index 0ee4320..ac5f61f 100644 --- a/jieba/__init__.py +++ b/jieba/__init__.py @@ -292,8 +292,10 @@ def __lcut_all(sentence): def __lcut_for_search(sentence): return list(__ref_cut_for_search(sentence)) +import multiprocessing + @require_initialized -def enable_parallel(processnum): +def enable_parallel(processnum=multiprocessing.cpu_count()): global pool,cut,cut_for_search if os.name=='nt': raise Exception("jieba: parallel mode only supports posix system")