trigrams are hard

Nice use of dictionary methods to create concise code.