def generate_batch(batch_size, skip_window):
    global data_index
batch = np.ndarray(shape=batch_size, dtype=np.int32)
labels = np.ndarray(shape=(batch_size, 1), dtype=np.int32)
batch_index = 0
while batch_index < batch_size:
    context = data[get_context_indices(data_index, skip_window)]
remaining_space = min(batch_size - batch_index, len(context))
batch[batch_index:batch_index + remaining_space] = context[0:remaining_space]
labels[batch_index:batch_index + remaining_space] = data[data_index]
batch_index += remaining_space
data_index = (data_index + 1) % len(data)
return batch, labels
Tensorflow implementation of word2vec