(g_wn, g_wc, g_wo, pr_wc, pr_wo, mode)
return cnt_list
pr's are all sorted as pr_wc are sorted in increasing order (in column idx)
        However, g's are not sorted.

        Sort g's in increasing order (in column idx)
pr's are all sorted as pr_wc are sorted in increasing order (in column idx)
        However, g's are not sorted.
pr s are all sorted as pr_wc are sorted in increasing order ( in column idx ) However g s are not sorted .
def get_cnt_wo_list(g_wn, g_wc, g_wo, pr_wc, pr_wo, mode):
    """ pr's are all sorted as pr_wc are sorted in increasing order (in column idx)
        However, g's are not sorted.

        Sort g's in increasing order (in column idx)
    """
    cnt_list=[]
    for b, g_wo1 in enumerate(g_wo):
        g_wc1 = g_wc[b]
        pr_wc1 = pr_wc[b]
        pr_wo1 = pr_wo[b]
        pr_wn1 = len(pr_wo1)
        g_wn1 = g_wn[b]

        if g_wn1 != pr_wn1:
            cnt_list.append(0)
            continue
        else:
            # Sort based wc sequence.
            if mode == 'test':
                idx = argsort(array(g_wc1))

                g_wo1_s = array(g_wo1)[idx]
                g_wo1_s = list(g_wo1_s)
            elif mode == 'train':
                # due to tearch forcing, no need to sort.
                g_wo1_s = g_wo1
            else:
                raise ValueError

            if type(pr_wo1) != list:
                raise TypeError
            if g_wo1_s == pr_wo1:
                cnt_list.append(1)
            else:
                cnt_list.append(0)
    return cnt_list
def get_cnt_wo_list ( g_wn , g_wc , g_wo , pr_wc , pr_wo , mode ) : cnt_list = [ ] for b , g_wo1 in enumerate ( g_wo ) : g_wc1 = g_wc [ b ] pr_wc1 = pr_wc [ b ] pr_wo1 = pr_wo [ b ] pr_wn1 = len ( pr_wo1 ) g_wn1 = g_wn [ b ] if g_wn1 != pr_wn1 : cnt_list . append ( 0 ) continue else : # Sort based wc sequence. if mode == 'test' : idx = argsort ( array ( g_wc1 ) ) g_wo1_s = array ( g_wo1 ) [ idx ] g_wo1_s = list ( g_wo1_s ) elif mode == 'train' : # due to tearch forcing, no need to sort. g_wo1_s = g_wo1 else : raise ValueError if type ( pr_wo1 ) != list : raise TypeError if g_wo1_s == pr_wo1 : cnt_list . append ( 1 ) else : cnt_list . append ( 0 ) return cnt_list