def get_word_dist(idx1, idx2):
    """
    get distance between two index tuples. Each index tuple contains (starting index, ending index)
    """
    dist = None
    for k in idx1:
        for j in idx2:
            curdist = abs(k - j)
            if dist is None:
                dist = curdist
            else:
                dist = min(dist, curdist)
    return dist