mirror of
https://github.com/fumiama/jieba.git
synced 2026-06-11 12:20:24 +08:00
small tweak, map stopWords' value are not used, no need to be string
This commit is contained in:
@@ -4,41 +4,41 @@ import (
|
|||||||
"github.com/wangbin/jiebago"
|
"github.com/wangbin/jiebago"
|
||||||
)
|
)
|
||||||
|
|
||||||
var stopWords map[string]string
|
var stopWords map[string]int
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
stopWords = map[string]string{
|
stopWords = map[string]int{
|
||||||
"the": "the",
|
"the": 1,
|
||||||
"of": "of",
|
"of": 1,
|
||||||
"is": "is",
|
"is": 1,
|
||||||
"and": "and",
|
"and": 1,
|
||||||
"to": "to",
|
"to": 1,
|
||||||
"in": "in",
|
"in": 1,
|
||||||
"that": "that",
|
"that": 1,
|
||||||
"we": "we",
|
"we": 1,
|
||||||
"for": "for",
|
"for": 1,
|
||||||
"an": "an",
|
"an": 1,
|
||||||
"are": "are",
|
"are": 1,
|
||||||
"by": "bye",
|
"by": 1,
|
||||||
"be": "be",
|
"be": 1,
|
||||||
"as": "as",
|
"as": 1,
|
||||||
"on": "on",
|
"on": 1,
|
||||||
"with": "with",
|
"with": 1,
|
||||||
"can": "can",
|
"can": 1,
|
||||||
"if": "of",
|
"if": 1,
|
||||||
"from": "from",
|
"from": 1,
|
||||||
"which": "which",
|
"which": 1,
|
||||||
"you": "you",
|
"you": 1,
|
||||||
"it": "it",
|
"it": 1,
|
||||||
"this": "this",
|
"this": 1,
|
||||||
"then": "then",
|
"then": 1,
|
||||||
"at": "at",
|
"at": 1,
|
||||||
"have": "have",
|
"have": 1,
|
||||||
"all": "all",
|
"all": 1,
|
||||||
"not": "not",
|
"not": 1,
|
||||||
"one": "one",
|
"one": 1,
|
||||||
"has": "has",
|
"has": 1,
|
||||||
"or": "or",
|
"or": 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ func SetStopWords(stopWordsFileName string) error {
|
|||||||
|
|
||||||
wtfs, err := jiebago.ParseDictFile(stopWordsFilePath)
|
wtfs, err := jiebago.ParseDictFile(stopWordsFilePath)
|
||||||
for _, wtf := range wtfs {
|
for _, wtf := range wtfs {
|
||||||
stopWords[wtf.Word] = wtf.Word
|
stopWords[wtf.Word] = 1
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user