Generates a from text files in a directory.

Used in the notebooks

Used in the guide Used in the tutorials

If your directory structure is:


Then calling text_dataset_from_directory(main_directory, labels='inferred') will return a that yields batches of texts from the subdirectories class_a and class_b, together with labels 0 and 1 (0 corresponding to class_a and 1 corresponding to class_b).

Only .txt files are supported at this time.

directory Directory where the data is located. If labels is "inferred", it should contain subdirectories, each containing text files for a class. Otherwise, the directory structure is ignored.
labels Either "inferred" (labe