def loadFeatStats(featFile, sent_indx, feat_offset):
    """ Loads the feature stats for all source sentences from features file. """

    global sentFVecDict
    line_cnt = 0
    cands_4_sent = 0
    featLst = []

    fF = open(featFile, 'r')
    for feat_line in fF:
        line_cnt += 1
        if line_cnt <= feat_offset: continue
        feat_line = feat_line.strip()

        if feat_line.startswith("FEATURES_TXT_BEGIN_0"):
            nbstHeaderLst = feat_line.split()
            src_indx = int(nbstHeaderLst[1])
        elif feat_line.startswith("FEATURES_TXT_END_0"):
            if src_indx < sent_indx: continue
            break
        elif src_indx == sent_indx:
            del featLst[:]
            for x in feat_line.split():
                featLst.append(float(x))
            if not sentFVecDict.has_key(src_indx):
                sentFVecDict[src_indx] = []
            sentFVecDict[src_indx].append( featLst[:] )
            cands_4_sent += 1

    fF.close()
    return cands_4_sent
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Decoder/mert-scripts/PRO.py/loadFeatStats/original