mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-24 21:54:24 +08:00
fixed the test failure problem, any tests that required load user data must put to the bottom of all other tests
This commit is contained in:
1
dict.txt
1
dict.txt
@@ -76272,6 +76272,7 @@ T台 3 n
|
|||||||
吉林人民出版社 3 nt
|
吉林人民出版社 3 nt
|
||||||
吉林大学 34 nt
|
吉林大学 34 nt
|
||||||
吉林工业大学 3 nt
|
吉林工业大学 3 nt
|
||||||
|
吉林 89 ns
|
||||||
吉林市 90 ns
|
吉林市 90 ns
|
||||||
吉林敖东 4 nr
|
吉林敖东 4 nr
|
||||||
吉林省 424 ns
|
吉林省 424 ns
|
||||||
|
|||||||
349046
posseg/dict.txt
349046
posseg/dict.txt
File diff suppressed because it is too large
Load Diff
@@ -293,61 +293,6 @@ func TestCut(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserDict(t *testing.T) {
|
|
||||||
jiebago.SetDictionary("../dict.txt")
|
|
||||||
jiebago.LoadUserDict("../userdict.txt")
|
|
||||||
sentence := "李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿例如我输入一个带“韩玉赏鉴”的标题,在自定义词库中也增加了此词为N类型"
|
|
||||||
cutResult := []WordTag{
|
|
||||||
WordTag{"\u674e\u5c0f\u798f", "nr"},
|
|
||||||
WordTag{"\u662f", "v"},
|
|
||||||
WordTag{"\u521b\u65b0\u529e", "i"},
|
|
||||||
WordTag{"\u4e3b\u4efb", "b"},
|
|
||||||
WordTag{"\u4e5f", "d"},
|
|
||||||
WordTag{"\u662f", "v"},
|
|
||||||
WordTag{"\u4e91\u8ba1\u7b97", "x"},
|
|
||||||
WordTag{"\u65b9\u9762", "n"},
|
|
||||||
WordTag{"\u7684", "uj"},
|
|
||||||
WordTag{"\u4e13\u5bb6", "n"},
|
|
||||||
WordTag{";", "x"},
|
|
||||||
WordTag{" ", "x"},
|
|
||||||
WordTag{"\u4ec0\u4e48", "r"},
|
|
||||||
WordTag{"\u662f", "v"},
|
|
||||||
WordTag{"\u516b\u4e00\u53cc\u9e7f", "nz"},
|
|
||||||
WordTag{"\u4f8b\u5982", "v"},
|
|
||||||
WordTag{"\u6211", "r"},
|
|
||||||
WordTag{"\u8f93\u5165", "v"},
|
|
||||||
WordTag{"\u4e00\u4e2a", "m"},
|
|
||||||
WordTag{"\u5e26", "v"},
|
|
||||||
WordTag{"\u201c", "x"},
|
|
||||||
WordTag{"\u97e9\u7389\u8d4f\u9274", "nz"},
|
|
||||||
WordTag{"\u201d", "x"},
|
|
||||||
WordTag{"\u7684", "uj"},
|
|
||||||
WordTag{"\u6807\u9898", "n"},
|
|
||||||
WordTag{"\uff0c", "x"},
|
|
||||||
WordTag{"\u5728", "p"},
|
|
||||||
WordTag{"\u81ea\u5b9a\u4e49\u8bcd", "n"},
|
|
||||||
WordTag{"\u5e93\u4e2d", "nrt"},
|
|
||||||
WordTag{"\u4e5f", "d"},
|
|
||||||
WordTag{"\u589e\u52a0", "v"},
|
|
||||||
WordTag{"\u4e86", "ul"},
|
|
||||||
WordTag{"\u6b64", "r"},
|
|
||||||
WordTag{"\u8bcd", "n"},
|
|
||||||
WordTag{"\u4e3a", "p"},
|
|
||||||
WordTag{"N", "eng"},
|
|
||||||
WordTag{"\u7c7b\u578b", "n"},
|
|
||||||
}
|
|
||||||
|
|
||||||
result := Cut(sentence, true)
|
|
||||||
if len(cutResult) != len(result) {
|
|
||||||
t.Error(result)
|
|
||||||
}
|
|
||||||
for i, _ := range result {
|
|
||||||
if result[i] != cutResult[i] {
|
|
||||||
t.Error(result[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBug132(t *testing.T) {
|
func TestBug132(t *testing.T) {
|
||||||
/*
|
/*
|
||||||
https://github.com/fxsjy/jieba/issues/132
|
https://github.com/fxsjy/jieba/issues/132
|
||||||
@@ -402,3 +347,58 @@ func TestBug137(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestUserDict(t *testing.T) {
|
||||||
|
jiebago.SetDictionary("../dict.txt")
|
||||||
|
jiebago.LoadUserDict("../userdict.txt")
|
||||||
|
sentence := "李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿例如我输入一个带“韩玉赏鉴”的标题,在自定义词库中也增加了此词为N类型"
|
||||||
|
cutResult := []WordTag{
|
||||||
|
WordTag{"\u674e\u5c0f\u798f", "nr"},
|
||||||
|
WordTag{"\u662f", "v"},
|
||||||
|
WordTag{"\u521b\u65b0\u529e", "i"},
|
||||||
|
WordTag{"\u4e3b\u4efb", "b"},
|
||||||
|
WordTag{"\u4e5f", "d"},
|
||||||
|
WordTag{"\u662f", "v"},
|
||||||
|
WordTag{"\u4e91\u8ba1\u7b97", "x"},
|
||||||
|
WordTag{"\u65b9\u9762", "n"},
|
||||||
|
WordTag{"\u7684", "uj"},
|
||||||
|
WordTag{"\u4e13\u5bb6", "n"},
|
||||||
|
WordTag{";", "x"},
|
||||||
|
WordTag{" ", "x"},
|
||||||
|
WordTag{"\u4ec0\u4e48", "r"},
|
||||||
|
WordTag{"\u662f", "v"},
|
||||||
|
WordTag{"\u516b\u4e00\u53cc\u9e7f", "nz"},
|
||||||
|
WordTag{"\u4f8b\u5982", "v"},
|
||||||
|
WordTag{"\u6211", "r"},
|
||||||
|
WordTag{"\u8f93\u5165", "v"},
|
||||||
|
WordTag{"\u4e00\u4e2a", "m"},
|
||||||
|
WordTag{"\u5e26", "v"},
|
||||||
|
WordTag{"\u201c", "x"},
|
||||||
|
WordTag{"\u97e9\u7389\u8d4f\u9274", "nz"},
|
||||||
|
WordTag{"\u201d", "x"},
|
||||||
|
WordTag{"\u7684", "uj"},
|
||||||
|
WordTag{"\u6807\u9898", "n"},
|
||||||
|
WordTag{"\uff0c", "x"},
|
||||||
|
WordTag{"\u5728", "p"},
|
||||||
|
WordTag{"\u81ea\u5b9a\u4e49\u8bcd", "n"},
|
||||||
|
WordTag{"\u5e93\u4e2d", "nrt"},
|
||||||
|
WordTag{"\u4e5f", "d"},
|
||||||
|
WordTag{"\u589e\u52a0", "v"},
|
||||||
|
WordTag{"\u4e86", "ul"},
|
||||||
|
WordTag{"\u6b64", "r"},
|
||||||
|
WordTag{"\u8bcd", "n"},
|
||||||
|
WordTag{"\u4e3a", "p"},
|
||||||
|
WordTag{"N", "eng"},
|
||||||
|
WordTag{"\u7c7b\u578b", "n"},
|
||||||
|
}
|
||||||
|
|
||||||
|
result := Cut(sentence, true)
|
||||||
|
if len(cutResult) != len(result) {
|
||||||
|
t.Error(result)
|
||||||
|
}
|
||||||
|
for i, _ := range result {
|
||||||
|
if result[i] != cutResult[i] {
|
||||||
|
t.Error(result[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user