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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user