MCPcopy Index your code
hub / github.com/huichen/sego / Test_Token_Split

Function Test_Token_Split

utils_test.go:104–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func Test_Token_Split(t *testing.T) {
105 probMap := map[string]string{
106 "衣门襟": "拉链",
107 "品牌": "天奕",
108 "图案": "纯色 字母",
109 "颜色分类": "牛奶白 水粉色 湖水蓝 浅军绿 雅致灰",
110 "尺码": "大码XL 大码XXL 大码XXXL 大码XXXXL",
111 "组合形式": "单件",
112 "面料": "聚酯",
113 "领型": "连帽",
114 "服饰工艺": "立体裁剪",
115 "货号": "YZL-1806052",
116 "厚薄": "超薄",
117 "年份季节": "2018年夏季",
118 "通勤": "韩版",
119 "服装款式细节": "不对称",
120 "成分含量": "81%(含)-90%(含)",
121 "袖型": "常规",
122 "风格": "通勤",
123 "适用年龄": "18-24周岁",
124 "服装版型": "宽松",
125 "大码女装分类": "其它特大款式",
126 "衣长": "中长款",
127 "袖长": "长袖",
128 "穿着方式": "开衫",
129 }
130 word := "卫衣女宽松拉链外套开衫韩版"
131 var segmenter Segmenter
132 segmenter.LoadDictionary("dictionary.txt")
133 segments := segmenter.InternalSegment([]byte(word),true)
134 for _,s := range segments{
135 fmt.Println(s.token.Text())
136 }
137 for _, value := range probMap {
138 for _, s := range segments {
139 if s.Token().Text() == value {
140 fmt.Println("=",value)
141 }
142 }
143 }
144}

Callers

nothing calls this directly

Calls 4

LoadDictionaryMethod · 0.95
InternalSegmentMethod · 0.95
TextMethod · 0.80
TokenMethod · 0.80

Tested by

no test coverage detected