The mutate function allows you to change an existing column or add a new column with the name specified before the = sign.
Here word is a column that exists in the dataframe that is created by unnest_tokens().
Following the = is the base function sub(), repeated below with the argument names inserted
sub(pattern = '[[:punct:]\u2019].*', replacement = '', x = word)
The sub function substitutes text as specified by the pattern argument, which is a regular expression. Regexes are pretty confusing when you first encounter them.
This one will look for any punctuation character ([:punct:]) and any ’ ("\u2019"). These two parts are enclosed in [] to designate a "character class". The brackets are followed by .* which means any and all characters following any punctuation will also be replaced.
The next argument is the replacement, ie what should replace any text found to match the pattern. In this case it replaced with a null string''.
The final argument x specifies the name of the object / column to search.
So this example replaces the word column with a modified version of itself.
For more info on regular expressions you could start with ?regex.
Here I used the base sub, there are tidyverse equivalents of the base regex functions in the package stringr
Hope this helps a bit.