In the function clean_googlengram the following if statement is used. The statements have no overlap as when tag == "." it would still evaluate to true as tag != "PUNCT". Probably and should be used here.
if tag != 'PUNCT' or tag != '.' or tag != '':
In the function
clean_googlengramthe following if statement is used. The statements have no overlap as whentag == "."it would still evaluate to true astag != "PUNCT". Probablyandshould be used here.