Add stop words to the config

This commit is contained in:
skiesel 2019-03-28 17:38:04 -04:00
parent 976ed02e72
commit e08601ebec
2 changed files with 180 additions and 2177 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,13 @@ func (p *TLDRPlugin) message(kind bot.Kind, message msg.Message, args ...interfa
p.lastRequest = time.Now()
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)
pipeline := nlp.NewPipeline(vectoriser, lda)
docsOverTopics, err := pipeline.FitTransform(p.getTopics()...)