1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-06-29 16:40:30 +08:00

code refactor for RegexpSplit function, moved it to util.go, add return chan string

This commit is contained in:
Wang Bin
2015-03-24 14:40:06 +08:00
parent 323b6714fa
commit 0027927b6d
5 changed files with 178 additions and 55 deletions

14
dict.go
View File

@@ -3,7 +3,6 @@ package jiebago
import (
"bufio"
"os"
"path/filepath"
"strconv"
"strings"
)
@@ -13,19 +12,6 @@ type WordTagFreq struct {
Freq float64
}
func DictPath(dictFileName string) (string, error) {
if filepath.IsAbs(dictFileName) {
return dictFileName, nil
}
var dictFilePath string
cwd, err := os.Getwd()
if err != nil {
return dictFilePath, err
}
dictFilePath = filepath.Clean(filepath.Join(cwd, dictFileName))
return dictFilePath, nil
}
func ParseDictFile(dictFilePath string) (wtfs []*WordTagFreq, err error) {
var dictFile *os.File
dictFile, err = os.Open(dictFilePath)