mirror of https://github.com/velour/catbase.git
Merge pull request #174 from velour/TLDRStopWords
Add stop words to the config
This commit is contained in:
commit
20c14080e8
File diff suppressed because it is too large
Load Diff
|
@ -48,7 +48,13 @@ func (p *TLDRPlugin) message(kind bot.Kind, message msg.Message, args ...interfa
|
||||||
p.lastRequest = time.Now()
|
p.lastRequest = time.Now()
|
||||||
nTopics := p.bot.Config().GetInt("TLDR.Topics", 5)
|
nTopics := p.bot.Config().GetInt("TLDR.Topics", 5)
|
||||||
|
|
||||||
vectoriser := nlp.NewCountVectoriser(THESE_ARE_NOT_THE_WORDS_YOU_ARE_LOOKING_FOR...)
|
stopWordSlice := p.bot.Config().GetArray("TLDR.StopWords", []string{})
|
||||||
|
if len(stopWordSlice) == 0 {
|
||||||
|
stopWordSlice = THESE_ARE_NOT_THE_WORDS_YOU_ARE_LOOKING_FOR
|
||||||
|
p.bot.Config().SetArray("TLDR.StopWords", stopWordSlice)
|
||||||
|
}
|
||||||
|
|
||||||
|
vectoriser := nlp.NewCountVectoriser(stopWordSlice...)
|
||||||
lda := nlp.NewLatentDirichletAllocation(nTopics)
|
lda := nlp.NewLatentDirichletAllocation(nTopics)
|
||||||
pipeline := nlp.NewPipeline(vectoriser, lda)
|
pipeline := nlp.NewPipeline(vectoriser, lda)
|
||||||
docsOverTopics, err := pipeline.FitTransform(p.getTopics()...)
|
docsOverTopics, err := pipeline.FitTransform(p.getTopics()...)
|
||||||
|
|
Loading…
Reference in New Issue