1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-09 11:00:23 +08:00

优化 dict, add fs.File 支持

This commit is contained in:
源文雨
2022-11-30 14:14:48 +08:00
parent c8785c7994
commit f3da9e6420
22 changed files with 190 additions and 91 deletions

View File

@@ -6,7 +6,7 @@ import (
func Example() {
var seg Segmenter
seg.LoadDictionary("dict.txt")
seg.LoadDictionaryAt("dict.txt")
fmt.Print("【全模式】:")
fmt.Println(seg.CutAll("我来到北京清华大学"))
@@ -28,7 +28,7 @@ func Example() {
func Example_suggestFrequency() {
var seg Segmenter
seg.LoadDictionary("dict.txt")
seg.LoadDictionaryAt("dict.txt")
sentence := "超敏C反应蛋白是什么"
fmt.Print("Before:")
@@ -76,13 +76,13 @@ func Example_suggestFrequency() {
func Example_loadUserDictionary() {
var seg Segmenter
seg.LoadDictionary("dict.txt")
seg.LoadDictionaryAt("dict.txt")
sentence := "李小福是创新办主任也是云计算方面的专家"
fmt.Print("Before:")
fmt.Println(seg.Cut(sentence, true))
seg.LoadUserDictionary("userdict.txt")
seg.LoadUserDictionaryAt("userdict.txt")
fmt.Print("After:")
fmt.Println(seg.Cut(sentence, true))