Conventions and style

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 

Get Natural Language Processing with Python Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.