mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
fix bug
This commit is contained in:
parent
dce353f88b
commit
d49542c06e
@ -2,7 +2,7 @@ import jieba
|
||||
import os
|
||||
|
||||
try:
|
||||
from analyzer import ChineseAnalyzer
|
||||
from .analyzer import ChineseAnalyzer
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
@ -43,7 +43,7 @@ def load_model():
|
||||
if sys.platform.startswith("java"):
|
||||
start_P, trans_P, emit_P = load_model()
|
||||
else:
|
||||
import prob_start,prob_trans,prob_emit
|
||||
from . import prob_start,prob_trans,prob_emit
|
||||
start_P, trans_P, emit_P = prob_start.P, prob_trans.P, prob_emit.P
|
||||
|
||||
def viterbi(obs, states, start_p, trans_p, emit_p):
|
||||
|
@ -16,7 +16,7 @@ def load_model(f_name,isJython=True):
|
||||
_curpath=os.path.normpath( os.path.join( os.getcwd(), os.path.dirname(__file__) ) )
|
||||
|
||||
result = {}
|
||||
with file(f_name, "rb") as f:
|
||||
with open(f_name, "rb") as f:
|
||||
for line in open(f_name,"rb"):
|
||||
line = line.strip()
|
||||
if line=="":continue
|
||||
@ -56,7 +56,7 @@ def load_model(f_name,isJython=True):
|
||||
if sys.platform.startswith("java"):
|
||||
char_state_tab_P, start_P, trans_P, emit_P, word_tag_tab = load_model(jieba.get_abs_path_dict())
|
||||
else:
|
||||
import char_state_tab, prob_start, prob_trans, prob_emit
|
||||
from . import char_state_tab, prob_start, prob_trans, prob_emit
|
||||
char_state_tab_P, start_P, trans_P, emit_P = char_state_tab.P, prob_start.P, prob_trans.P, prob_emit.P
|
||||
word_tag_tab = load_model(jieba.get_abs_path_dict(),isJython=False)
|
||||
|
||||
|
@ -5,7 +5,7 @@ from whoosh.index import create_in,open_dir
|
||||
from whoosh.fields import *
|
||||
from whoosh.qparser import QueryParser
|
||||
|
||||
from jieba.analyse.analyzer import ChineseAnalyzer
|
||||
from jieba.analyse import ChineseAnalyzer
|
||||
|
||||
analyzer = ChineseAnalyzer()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user