Consider the following snippet of code:
for _, tt := range a {
for _, word := range strings.Fields(tt.FullText) {
wordID, ok := p.single(word)
if ok {
tt.ids = append(tt.ids, wordID)
}
if word == "rt" {
tt.isRT = true
}
}
p.tfidf.Add(tt)
}
What it says is after we've preprocessed every single word, we simply add that word to the TFIDF.