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