Skip to content

Commit

Permalink
hold the backward compatibility, let jython use a special loading wor…
Browse files Browse the repository at this point in the history
…kflow
  • Loading branch information
fxsjy committed Jul 25, 2013
1 parent 8757148 commit d4ede0f
Show file tree
Hide file tree
Showing 10 changed files with 191,267 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,5 @@ pip-log.txt
*.log
test/tmp/*

#jython
*.class
7 changes: 6 additions & 1 deletion jieba/finalseg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
import os
import marshal
import sys

MIN_FLOAT=-3.14e100

Expand Down Expand Up @@ -39,7 +40,11 @@ def load_model():

return start_p, trans_p, emit_p

start_P, trans_P, emit_P = load_model()
if sys.platform.startswith("java"):
start_P, trans_P, emit_P = load_model()
else:
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):
V = [{}] #tabular
Expand Down
Loading

0 comments on commit d4ede0f

Please sign in to comment.