INNER CODE UNIT · Python

sorted_all

yuhaozhang/tacred-relation · data/loader.py:128

    sorted_all = [list(t) for t in zip(*sorted(zip(*unsorted_all), reverse=True))]
    return sorted_all[2:], sorted_all[1]

def word_dropout(tokens, dropout):
    """ Randomly dropout tokens (IDs) and replace them with <UNK> tokens. """
    return [constant.UNK_ID if x != constant.UNK_ID and np.random.random() < dropout \
            else x for x in tokens]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…