-
Notifications
You must be signed in to change notification settings - Fork 0
/
part3.txt
39 lines (25 loc) · 1017 Bytes
/
part3.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
jieba.posseg.__init__.py
from __future__ import absolute_import, unicode_literals
import os
import re
import sys
import jieba
import pickle
from .._compat import *
from .viterbi import viterbi
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab.p" # 字为key对应的可能的 BMES状态和相应的词性
re_han_detail = re.compile("([\u4E00-\u9FD5]+)") # 至少一个汉字
re_skip_detail = re.compile("([\.0-9]+|[a-zA-Z0-9]+)") # 小数或数字和字母混合
re_han_internal = re.compile("([\u4E00-\u9FD5a-zA-Z0-9+#&\._]+)") # 至少一个汉字,字母,数字或+#&\._
re_skip_internal = re.compile("(\r\n|\s)") # 空白符
re_eng = re.compile("[a-zA-Z0-9]+") # 字母或数字
re_num = re.compile("[\.0-9]+") # 数字
re_eng1 = re.compile('^[a-zA-Z0-9]$', re.U) # 匹配头尾 字母或数字
def load_model():
载入数据 start_p trans_p state
pass
如果平台是以java开头,就调用load_model # for Jython
否则就直接import导入数据即可