I am trying to define a vocabulary with PyTorch to later input my dataset into a Neural Network. This would be the first step to create a dataset.
This is the code I am using:
text_field = torchtext.data.Field(tokenize="spacy")
text_field.build_vocab(train_data.Text, min_freq=3)
By running the code, I get the following error: "module 'torchtext.data' has no attribute 'Field'" I already looked at solutions where they suggest to use "torchtext.legacy.data.Field" instead, but nothing seems to work. I am using Python 3.10.1 and torchtext 0.15.1. Does anyone knows how to solve this issue?