mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-24 00:00:05 +08:00
commit
0125548a37
@ -2,7 +2,7 @@ import jieba
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from analyzer import ChineseAnalyzer
|
from .analyzer import ChineseAnalyzer
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def load_model():
|
|||||||
|
|
||||||
emit_p = {}
|
emit_p = {}
|
||||||
abs_path = os.path.join(_curpath, PROB_EMIT_P)
|
abs_path = os.path.join(_curpath, PROB_EMIT_P)
|
||||||
with file(abs_path, 'rb') as f:
|
with open(abs_path, 'rb') as f:
|
||||||
emit_p = marshal.load(f)
|
emit_p = marshal.load(f)
|
||||||
f.closed
|
f.closed
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@ def load_model(f_name,isJython=True):
|
|||||||
|
|
||||||
emit_p = {}
|
emit_p = {}
|
||||||
abs_path = os.path.join(_curpath, PROB_EMIT_P)
|
abs_path = os.path.join(_curpath, PROB_EMIT_P)
|
||||||
with file(abs_path, 'rb') as f:
|
with open(abs_path, 'rb') as f:
|
||||||
emit_p = marshal.load(f)
|
emit_p = marshal.load(f)
|
||||||
f.closed
|
f.closed
|
||||||
|
|
||||||
state = {}
|
state = {}
|
||||||
abs_path = os.path.join(_curpath, CHAR_STATE_TAB_P)
|
abs_path = os.path.join(_curpath, CHAR_STATE_TAB_P)
|
||||||
with file(abs_path, 'rb') as f:
|
with open(abs_path, 'rb') as f:
|
||||||
state = marshal.load(f)
|
state = marshal.load(f)
|
||||||
f.closed
|
f.closed
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from whoosh.index import create_in,open_dir
|
|||||||
from whoosh.fields import *
|
from whoosh.fields import *
|
||||||
from whoosh.qparser import QueryParser
|
from whoosh.qparser import QueryParser
|
||||||
|
|
||||||
from jieba.analyse.analyzer import ChineseAnalyzer
|
from jieba.analyse import ChineseAnalyzer
|
||||||
|
|
||||||
analyzer = ChineseAnalyzer()
|
analyzer = ChineseAnalyzer()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user