Implement functions to extract bi- and trigrams