I have a dataframe, which has two columns (review and sentiment). I am using pytorch and torchtext library for preprocessing data. Is it possible to use dataframe as source to read data from, in torchtext? I am looking for something similar to, but not
data.TabularDataset.splits(path='./data')
I have performed some operation (clean, change to required format) on data and final data is in a dataframe.
If not torchtext, what other package would you suggest that would help in preprocessing text data present in a datarame. I could not find anything online. Any help would be great.
Adapting the
DatasetandExampleclasses fromtorchtext.dataThen, first define
fieldsusingtorchtext.datafields. For example:before simply loading the dataframes: