在keras中读取情绪分析的处理数据集

2024-06-12 12:21:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用经过处理的数据集来进行来自here的情绪分析,但我不太确定如何读取它以将其输入到keras模型中

我习惯使用pandas来读取csv或json格式,但是这个有以下格式

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

这是一个例子(一个评论和它的情绪):

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

事实证明,这个数据集已经在几篇论文中使用过,是多领域情绪分析的基准,所以我想知道如何在keras中读取它并将其用作输入


Tags: andthemostlabelartwork情绪containsagain