bentrevett/pytorch-sentiment-analysis

Multi-class Sentiment Analysis: How to use custom dataset?

LinuxBeginner opened this issue · 0 comments

Hi, Thank you very much for sharing this tutorial.

In the tutorial, the dataset used is from IMDB.

However, in my case, I have three text files with class A, B and C separately.

How should I edit the code to run it for my dataset.

I have gone through this tutorial (Using TorchText with Your Own Datasets) too, still I am not able to relate it.

Right now I have created one json file by combining the three files and shuffle it, below is the format for first 3 lines from the file:


{'text': ['Line1word1','Line1word2','Line1word3','Line1word4']'label': 'A'}
{'text': ['Line2word1','Line2word2','Line2word3']'label': 'B'}
{'text': ['Line3word1','Line3word2','Line3word3','Line3word4']'label': 'A'}

How do I input the above file?