@classmethod
    def helperLM(cls, consItems, is_last_cell, lmFeatVec):
        '''Helper function for computing the two functions p() and q() and scoring'''

        lm_indx = 0
        tot_lm_heu = 0.0
        tot_lm_score = 0.0
        for lm_obj in cls.lmLst:
            cons_item = consItems[lm_indx]
            lm_lprob = 0.0

            # Computing n-gram LM-score for partial candidate hypotheses
            if lm_obj.lm_order < cons_item.e_len:
                if cls.use_srilm: lm_H = lm_obj.getLMHeuCost(cons_item.eTgtLst, cons_item.e_len)
                else: lm_H = lm_obj.getLMHeuCost(cons_item)
            else:
                # Compute the LM probabilities for all complete m-grams in the elided target string, and
                # Compute heuristic prob for first m-1 terms in target
                if cls.use_srilm:
                    (lm_lprob, eTgtLst) = lm_obj.scorePhrnElide(cons_item.eTgtLst, cons_item.e_len, cons_item.mgramSpans)
                    lm_H = lm_obj.getLMHeuCost(cons_item.eTgtLst, cons_item.e_len)
                else:
                    lm_lprob = lm_obj.scoremGrams(cons_item.phrStateTupLst)
                    lm_H = lm_obj.getLMHeuCost(cons_item)

            if ( is_last_cell ):                                 # lm_heu is added permanently in the last cell
                if cons_item.new_elided_tgt: lm_lprob += lm_H
                lm_H = 0.0

            lmFeatVec[lm_indx] += lm_lprob
            tot_lm_heu += (cls.lmWgts[lm_indx] * lm_H)           # Heuristic LM score (pruning score is the sum of heuristic score and lm comp score so far)
            if cons_item.new_elided_tgt:
                tot_lm_score += (cls.lmWgts[lm_indx] * lm_lprob) # LM score for the m-grams in this hypothesis
            lm_indx += 1

        return (tot_lm_score, tot_lm_heu)
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Decoder/languageModelManager.py/LanguageModelManager.helperLM/swapped operands of `<`