If the different lines of your input file represent different contexts then tensorflow/models/embedding/word2vec.py won't work for you as it wraps each line into a single giant sentence. You will need to rewrite the customer operator kernel here:
https://github.com/tensorflow/models/blob/master/tutorials/embedding/word2vec_kernels.cc
Below is an example of one of the functions that needs to change:
void NextExample(int *label, int *example) {
while (true) {
if (label_pos_ >= label_limit_) {
++total_words_processed_;
++sentence_index_;
// check if we hit the end of the sentence
if (sentence_index_ >= sentence_size_) {
sentence_index_ = 0;
++corpus_idx_;
// check if we hit the end of the corpus
if (corpus_idx_ >= nrows_) {
++current_epoch_;
corpus_idx_ = 0;
}
sentence_ = corpus_[corpus_idx_];
}
label_pos_ = std::max<int>(0, sentence_index_ - window_size_);
label_limit_ =
std::min<int>(sentence_.size(), sentence_index_ + window_size_ + 1);
}
if (sentence_index_ != label_pos_) // add constraint that tokens are different
break;
++label_pos_;
}
*example = sentence_[sentence_index_];
*label = sentence_[label_pos_++];
}