working trigram model