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

move dictPath function private

This commit is contained in:
Wang Bin
2015-03-30 11:02:57 +08:00
parent 79adffe328
commit a66bf2a0bd
4 changed files with 12 additions and 16 deletions

11
util.go
View File

@@ -13,7 +13,7 @@ import (
"strings"
)
func DictPath(dictFileName string) (string, error) {
func dictPath(dictFileName string) (string, error) {
if filepath.IsAbs(dictFileName) {
return dictFileName, nil
}
@@ -26,7 +26,12 @@ func DictPath(dictFileName string) (string, error) {
return dictFilePath, nil
}
func LoadDict(l DictLoader, dictFilePath string, usingFlag bool) error {
func LoadDict(l DictLoader, dictFileName string, usingFlag bool) error {
dictFilePath, err := dictPath(dictFileName)
if err != nil {
return err
}
log.Printf("Building Trie..., from %s\n", dictFilePath)
dictFile, err := os.Open(dictFilePath)
@@ -96,7 +101,7 @@ func dump(c Cacher, cachePath string) error {
}
func SetDict(l DictLoader, dictName string, pos bool) error {
dictPath, err := DictPath(dictName)
dictPath, err := dictPath(dictName)
if err != nil {
return err
}