The code, iterators, and wrappers that we will be using are from Practical Torchtext. This is a torchtext tutorial that was created by Keita Kurita—one of the top five contributors to torchtext.
The naming conventions and style are loosely inspired from the preceding work and fastai—a deep learning framework based on PyTorch itself.
Let's begin by setting up the required variable placeholders in place:
from torchtext.data import Field
The Field class determines how the data is preprocessed and converted into a numeric format. The Field class is a fundamental torchtext data structure and worth looking into. The Field class models common text processing and sets them up for numericalization (or vectorization):
LABEL