0

I want to use the processed dataset for the sentiment analysis from here but I am not quite sure how to read it to input it in keras model.

I am used to using pandas to read the csv or json format but this one has the following format.

feature:<count> .... feature:<count> #label#:<label> 

This is the example (one review and it's sentiment):

woman_the:1 contains_the:1 fan_i:1 alex_ross(superman:1 justice:1 read:1 comics_fan:1 again:1 league_etc:1 fans:1 recieved:1 hanna-barbera!)_a:1 book_fans:1 wonder:1 gift:1 gorgeous_artwork:1 gift_and:1 contains:1 i_recieved:1 artwork:2 christmas:1 read_it:1 wonder_woman:1 justice_league:1 a_comics:1 again_and:1 even:1 i_read:1 the_most:2 gorgeous:1 of_alex:1 i:2 extraordinary:1 most_gorgeous:1 most:2 it_again:1 comic_books:1 and_i:1 ross(superman_batman:1 etc_even:1 etc:1 the_justice:1 fan:1 beautiful:1 again.a:1 even_hanna-barbera!):1 comics:1 batman_wonder:1 for_comic:1 in_comic:1 artwork_in:1 books_contains:1 woman:1 a_christmas:1 extraordinary_artwork:1 books:1 christmas_gift:1 ross(superman:1 league:1 artwork_of:1 most_extraordinary:1 comic_book:1 book:1 recieved_this:1 batman:1 must-have_for:1 hanna-barbera!):1 must-have:1 again.a_must-have:1 alex:1 and_again.a:1 comic:2 #label#:positive

It turns out this dataset has been used in several paper and is kind of a benchmark for multi-domain sentiment analysis so I want to know how to read it in keras and use it as a input.

BlueMango
  • 463
  • 7
  • 21
  • This looks like a bag of words representation? So your model inputs could be just be vectors and not sequences. – sdcbr Dec 07 '18 at 16:53
  • Yes, it's a bag of words representation but how to process it so that it can be used in keras – BlueMango Dec 07 '18 at 17:35

0 Answers0