graykode / nlp-tutorial

Natural Language Processing Tutorial for Deep Learning Researchers
https://www.reddit.com/r/MachineLearning/comments/amfinl/project_nlptutoral_repository_who_is_studying/
MIT License
14.31k stars 3.95k forks source link

About make_batch of NNLM #67

Open KODGV opened 3 years ago

KODGV commented 3 years ago
input = [word_dict[n] for n in word[:-1]]  # create (1~n-1) as input
target = [word_dict[word[-1]]]

it constraints the length of input and n_step. I think the following example is even better

    for i in range(len(words) - window_size + 1):`
       ` x_train.append(words[i: i + window_size - 1])`
        `y_train.append(words[i + window_size - 1])