dennybritz / cnn-text-classification-tf

Convolutional Neural Network for Text Classification in Tensorflow
Apache License 2.0
5.64k stars 2.77k forks source link

I am having an issue with reading my own data #113

Open alialwehaibi opened 6 years ago

alialwehaibi commented 6 years ago

The code runs fine on your data but having an issue with mine! I edited the code (in _datahelpers.py) to fit my data but still not work. Here is the changes for _load_data_andlabels function:

`def load_data_and_labels(tweets_file, emojis_file):

tweets = list(open(tweets_file, "r").readlines())
tweets = [s.strip() for s in tweets]            
# Split by words    
x_text = [clean_str(tweet) for tweet in tweets]
# load labels
y = list(open(emojis_file, "r").readlines())
y = np.array(y)
return [x_text, y]`

Please, notice that my data are in two files, one for text (x_text) and the other is for labels (y). Each text in the first file has its associate label in the second file as a number between 0 and 19. Any suggestion(s)! please.

self-ms commented 10 months ago

If your data is embedded and labels are available, you can use the following repository: https://github.com/ms-unlimit/Transformer-Based-Machine-Learning-Framework