refactor language_model functions to use analysis object (adding log likelihood)