wrote function to compute trigram probability