After we've removed the stopwords, it's time to process the special Twitter entities:
if strings.HasPrefix(word, "#") { return p.corpus.Add(hashtag), true } if strings.HasPrefix(word, "@") { return p.corpus.Add(mention), true } if strings.HasPrefix(word, "http://") { return p.corpus.Add(url), true }
These are straightforwards enough.
If a word begins with "#", then it's a hashtag. We might want to come back to this later, so it's good to keep this in mind.
Any word that begins with a "@" is a mention. This is a little tricky. Sometimes, people tweet things such as I am @PlaceName, indicating a location, as opposed to mentioning a user (indeed, one may find @PlaceName does not exist). Or, alternatively, people ...