mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-11 04:10:25 +08:00
added more examples
This commit is contained in:
21
posseg/example_test.go
Normal file
21
posseg/example_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package posseg_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/wangbin/jiebago/posseg"
|
||||
)
|
||||
|
||||
func Example() {
|
||||
var seg posseg.Segmenter
|
||||
seg.LoadDictionary("../dict.txt")
|
||||
|
||||
for segment := range seg.Cut("我爱北京天安门", true) {
|
||||
fmt.Printf("%s %s\n", segment.Text(), segment.Pos())
|
||||
}
|
||||
// Output:
|
||||
// 我 r
|
||||
// 爱 v
|
||||
// 北京 ns
|
||||
// 天安门 ns
|
||||
}
|
||||
Reference in New Issue
Block a user