From 35aa38ed125b1e713590a4b400aabf540af323d5 Mon Sep 17 00:00:00 2001 From: Sun Junyi Date: Sun, 28 Apr 2013 12:04:16 +0800 Subject: [PATCH] fix a bug caused by default argument binding --- jieba/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jieba/__init__.py b/jieba/__init__.py index 826b5d8..9cd2c6d 100644 --- a/jieba/__init__.py +++ b/jieba/__init__.py @@ -44,8 +44,12 @@ def gen_trie(f_name): raise e return trie, lfreq,ltotal -def initialize(dictionary=DICTIONARY): +def initialize(*args): global trie, FREQ, total, min_freq, initialized + if len(args)==0: + dictionary = DICTIONARY + else: + dictionary = args[0] with DICT_LOCK: if initialized: return