trigrams are hard

This isn't wrong, but you could save some typing, by declaring all of this in the dictionary literal when you assign it:

    d = {
        'name': 'Chris',
        # 'key': 'value',
    }