1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-28 08:02:45 +08:00

small tweaks, add docs

This commit is contained in:
Wang Bin
2015-02-28 17:08:04 +08:00
parent 142b90f76a
commit 858ceb5a0b
8 changed files with 420 additions and 393 deletions

View File

@@ -20,6 +20,8 @@ type WordTag struct {
Word, Tag string
}
// Set dictionary, it could be absolute path of dictionary file, or dictionary
// name in current diectory.
func SetDictionary(dictFileName string) error {
err := jiebago.SetDictionary(dictFileName)
if err != nil {
@@ -42,7 +44,7 @@ func cutDetailInternal(sentence string) chan WordTag {
go func() {
runes := []rune(sentence)
_, posList := Viterbi(runes)
_, posList := viterbi(runes)
begin := 0
next := 0
for i, char := range runes {
@@ -232,6 +234,8 @@ func cutDAGNoHMM(sentence string) chan WordTag {
return result
}
// Tags the POS of each word after segmentation, using labels compatible with
// ictclas.
func Cut(sentence string, HMM bool) chan WordTag {
for key := range jiebago.UserWordTagTab {
wordTagMap[key] = jiebago.UserWordTagTab[key]