def input_fn(words_file, tags_file, params=None, shuffle_and_repeat=False):
    "Creates tensorflow dataset using the generator_fn\n\n    :param words_file: file path of the words file (one sentence per line)\n    :param tags_file: file path of tags file (tags corresponding to words file)\n    :param params: if not None then model hyperparameters expected - 'buffer' (as in buffer size) and 'epochs'\n    :param shuffle_and_repeat: if the input is to be shuffled and repeat-delivered (say per epoch)\n    :return: instance of tf.data.Dataset\n    "
    params = (params if (params is not None) else {})
    shapes = (([None], ()), [None])
    types = ((tf.string, tf.int32), tf.string)
    defaults = (('<pad>', 0), 'O')
    generator = functools.partial(generator_fn, words_file, tags_file)
    dataset = tf.data.Dataset.from_generator(generator, output_shapes=shapes, output_types=types)
    if shuffle_and_repeat:
        dataset = dataset.shuffle(params['buffer']).repeat(params['epochs'])
    dataset = dataset.padded_batch(params.get('batch_size', 20), shapes, defaults).prefetch(1)
    return dataset
Creates tensorflow dataset using the generator_fn

:param words_file: file path of the words file (one sentence per line)
:param tags_file: file path of tags file (tags corresponding to words file)
:param params: if not None then model hyperparameters expected - 'buffer' (as in buffer size) and 'epochs'
:param shuffle_and_repeat: if the input is to be shuffled and repeat-delivered (say per epoch)
:return: instance of tf.data.Dataset
def input_fn(words_file, tags_file, params=None, shuffle_and_repeat=False):
    "Creates tensorflow dataset using the generator_fn\n\n    :param words_file: file path of the words file (one sentence per line)\n    :param tags_file: file path of tags file (tags corresponding to words file)\n    :param params: if not None then model hyperparameters expected - 'buffer' (as in buffer size) and 'epochs'\n    :param shuffle_and_repeat: if the input is to be shuffled and repeat-delivered (say per epoch)\n    :return: instance of tf.data.Dataset\n    "
    params = (params if (params is not None) else {})
    shapes = (([None], ()), [None])
    types = ((tf.string, tf.int32), tf.string)
    defaults = (('<pad>', 0), 'O')
    generator = functools.partial(generator_fn, words_file, tags_file)
    dataset = tf.data.Dataset.from_generator(generator, output_shapes=shapes, output_types=types)
    if shuffle_and_repeat:
        dataset = dataset.shuffle(params['buffer']).repeat(params['epochs'])
    dataset = dataset.padded_batch(params.get('batch_size', 20), shapes, defaults).prefetch(1)
    return dataset