def generateCandidatePool(sent_indx, cand_hyp_cnt, metricScores):
    global tot_feats
    global pairs_2_consider
    global pairs_2_include
    global sentFVecDict

    sum_g_diffential = 0.0
    hypData = []
    hypVal = []
    hypPairItem = []
    samplePairs = []
    candPairsDict = {}
    if cand_hyp_cnt <= 2: return hypData, hypVal

    featVecLst = sentFVecDict[sent_indx]
    if tot_feats == -1:
        tot_feats = len( featVecLst[0] )

    for l_indx in xrange(pairs_2_consider):
        randTup = tuple( random.sample(xrange(cand_hyp_cnt), 2) )
        if randTup[0] == randTup[1]: continue
        g_diff = math.fabs(metricScores[randTup[0]] - metricScores[randTup[1]])
        if not g_diff: continue
        pairIndxT = randTup if randTup[0] < randTup[1] else (randTup[1], randTup[0])
        if candPairsDict.has_key(pairIndxT): continue
        candPairsDict[pairIndxT] = 1

        sum_g_diffential += g_diff
        hypPairItem.append( g_diff )
        hypPairItem.append( (randTup) )
        samplePairs.append(hypPairItem[:])
        del hypPairItem[:]

    if (not samplePairs): return hypData, hypVal
    candPool = samplerHelper(sum_g_diffential, samplePairs)
    candPool.sort(key = itemgetter(0), reverse = True)
    sampled_pairs = pairs_2_include if len(candPool) > pairs_2_include else len(candPool)
    for l_indx in xrange(sampled_pairs):
        (curr_g_diff, randTup) = candPool[l_indx]

        if use_bin_clsfr:           # Use pair-wise tuning with binary classifier (Hopkins & May, 2011)
            hypVal.append(1)
            hypVal.append(0)
        else:                       # Use pair-wise tuning with linear regression (Bazrafshan, Chung and Gildea, 2012)
            hypVal.append(  math.fabs(metricScores[randTup[0]] - metricScores[randTup[1]]) )
            hypVal.append( -math.fabs(metricScores[randTup[1]] - metricScores[randTup[0]]) )

        hypVec1 = []
        hypVec2 = []
        if ( metricScores[randTup[0]] > metricScores[randTup[1]] ):
            for f_indx in xrange( tot_feats ):
                hypVec1.append(featVecLst[randTup[0]][f_indx] - featVecLst[randTup[1]][f_indx])
                hypVec2.append(featVecLst[randTup[1]][f_indx] - featVecLst[randTup[0]][f_indx])
        else:
            for f_indx in xrange( tot_feats ):
                hypVec1.append(featVecLst[randTup[1]][f_indx] - featVecLst[randTup[0]][f_indx])
                hypVec2.append(featVecLst[randTup[0]][f_indx] - featVecLst[randTup[1]][f_indx])

        hypData.append(hypVec1[:])
        hypData.append(hypVec2[:])
        del hypVec1[:]
        del hypVec2[:]

    return hypData, hypVal
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Decoder/mert-scripts/PRO.py/generateCandidatePool/original