Skip to content

Commit 7e207e8

Browse files
committedFeb 24, 2019
clear some internal api name and update godoc
1 parent de8000b commit 7e207e8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎dict_util.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (seg *Segmenter) AddToken(text string, frequency int, pos ...string) {
5656
// AddTokenForce add new text to token and force
5757
func (seg *Segmenter) AddTokenForce(text string, frequency int, pos ...string) {
5858
seg.AddToken(text, frequency, pos...)
59-
seg.SegToken()
59+
seg.CalcToken()
6060
}
6161

6262
// LoadDict load the dictionary from the file
@@ -120,7 +120,7 @@ func (seg *Segmenter) LoadDict(files ...string) error {
120120
// }
121121
// }
122122

123-
seg.SegToken()
123+
seg.CalcToken()
124124
log.Println("Gse dictionary loaded finished.")
125125

126126
return nil
@@ -277,8 +277,8 @@ func IsJp(segText string) bool {
277277
return false
278278
}
279279

280-
// SegToken add segmenter token
281-
func (seg *Segmenter) SegToken() {
280+
// CalcToken calc the segmenter token
281+
func (seg *Segmenter) CalcToken() {
282282
// 计算每个分词的路径值,路径值含义见 Token 结构体的注释
283283
logTotalFrequency := float32(math.Log2(float64(seg.dict.totalFrequency)))
284284
for i := range seg.dict.tokens {

‎dictionary.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func (dict *Dictionary) NumTokens() int {
4343
return len(dict.tokens)
4444
}
4545

46-
// TotalFrequency 词典中所有分词的频率之和
47-
func (dict *Dictionary) TotalFrequency() int64 {
46+
// TotalFreq 词典中所有分词的频率之和
47+
func (dict *Dictionary) TotalFreq() int64 {
4848
return dict.totalFrequency
4949
}
5050

0 commit comments

Comments
 (0)
Please sign in to comment.