'Fill input queue with ModelInput.'

def _FillInputQueue(self):

    start_id = self._vocab.WordToId(data.SENTENCE_START)
    end_id = self._vocab.WordToId(data.SENTENCE_END)
    pad_id = self._vocab.WordToId(data.PAD_TOKEN)
    input_gen = self._TextGenerator(data.ExampleGen(self._data_path))
    while True:
        (article, abstract) = six.next(input_gen)
        article_sentences = [sent.strip() for sent in data.ToSentences(article, include_token=False)]
        abstract_sentences = [sent.strip() for sent in data.ToSentences(abstract, include_token=False)]
        enc_inputs = []
        dec_inputs = [start_id]
        for i in xrange(min(self._max_article_sentences, len(article_sentences))):
            enc_inputs += data.GetWordIds(article_sentences[i], self._vocab)
        for i in xrange(min(self._max_abstract_sentences, len(abstract_sentences))):
            dec_inputs += data.GetWordIds(abstract_sentences[i], self._vocab)
        if ((len(enc_inputs) < self._hps.min_input_len) or (len(dec_inputs) < self._hps.min_input_len)):
            tf.logging.warning('Drop    an    example    -    too    short.\nenc:%d\ndec:%d', len(enc_inputs), len(dec_inputs))
            continue
        if (not self._truncate_input):
            if ((len(enc_inputs) > self._hps.enc_timesteps) or (len(dec_inputs) > self._hps.dec_timesteps)):
                tf.logging.warning('Drop    an    example    -    too    long.\nenc:%d\ndec:%d', len(enc_inputs), len(dec_inputs))
                continue
        else:
            if (len(enc_inputs) > self._hps.enc_timesteps):
                enc_inputs = enc_inputs[:self._hps.enc_timesteps]
            if (len(dec_inputs) > self._hps.dec_timesteps):
                dec_inputs = dec_inputs[:self._hps.dec_timesteps]
        targets = dec_inputs[1:]
        targets.append(end_id)
        enc_input_len = len(enc_inputs)
        dec_output_len = len(targets)
        while (len(enc_inputs) < self._hps.enc_timesteps):
            enc_inputs.append(pad_id)
        while (len(dec_inputs) < self._hps.dec_timesteps):
            dec_inputs.append(end_id)
        while (len(targets) < self._hps.dec_timesteps):
            targets.append(end_id)
        element = ModelInput(enc_inputs, dec_inputs, targets, enc_input_len, dec_output_len, '    '.join(article_sentences), '    '.join(abstract_sentences))
        self._input_queue.put(element)
