def get_target_indice_from_leaves(targets, sent):
    """
    Find the indice of the target words in the terminal sequence of a parsed sentence.
    """
    target_indice = []
    idx = 0
    current_target = targets[idx]
    for k, w in enumerate(sent):
        if w == current_target:
            target_indice.append(k)
            idx += 1
            if idx == len(targets):
                break
            current_target = targets[idx]
    try:
        len(target_indice) == len(targets)
    except ValueError:
        print(targets)
        print(' '.join(sent))

    return target_indice