Skip to content

Commit

Permalink
修改: bot/adapters/storage/memorystorage.go
Browse files Browse the repository at this point in the history
  • Loading branch information
TsaoLun committed Aug 15, 2023
1 parent 0b73560 commit fc2f92d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bot/adapters/storage/memorystorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ var (
generatedStopWordsFile = "../etc/stopwords.txt"
)

func init() {
// 获取当前文件的绝对路径
dir, _ := os.Getwd()
dictFile = path.Join(dir, dictFile)
idfFile = path.Join(dir, idfFile)
stopWordsFile = path.Join(dir, stopWordsFile)
generatedStopWordsFile = path.Join(dir, generatedStopWordsFile)
}

type (
keyChunk struct {
offfset int
Expand All @@ -45,12 +54,6 @@ type (

func RestoreMemoryStorage(decoder *gob.Decoder) (*memoryStorage, error) {
var segmenter jiebago.Segmenter
// 获取当前文件的绝对路径
dir, _ := os.Getwd()
dictFile = path.Join(dir, dictFile)
idfFile = path.Join(dir, idfFile)
stopWordsFile = path.Join(dir, stopWordsFile)
generatedStopWordsFile = path.Join(dir, generatedStopWordsFile)
logx.Must(segmenter.LoadDictionary(dictFile))
var extracter analyse.TagExtracter
logx.Must(extracter.LoadDictionary(dictFile))
Expand Down

0 comments on commit fc2f92d

Please sign in to comment.