code: def applyLM(parentBeam, childBeam, classes, lm):
      
      if lm and not childBeam.lmApplied:
          c1 = classes[parentBeam.labeling[-1] if parentBeam.labeling else classes.index(' ')] # first char
          c2 = classes[childBeam.labeling[-1]] # second char
          lmFactor = 0.01 # influence of language model
          bigramProb = lm.getCharBigram(c1, c2) ** lmFactor # probability of seeing first and second char next to each other
          childBeam.prText = parentBeam.prText * bigramProb # probability of char sequence
          childBeam.lmApplied = True
docs: calculate LM score of child beam by taking score from parent beam and bigram probability of last two chars