Preprocessing Twitter entities 

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 ...

Get Go Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.