我正在使用此数据进行预处理:
Name Nickname Age Country Reg_Date Text
Matt LeBron 63 Canada 24-12-2008 I'm in a happy mood today. I go to beach
Chris Severine 54 U.S. 15-07-2009 I stand in solidarity with #ows
Lucas Daly 47 Ireland 01-05-2020 Trump is working for next politician...
Clash Lynch 24 U.S. 13-11-2008 What a wonderful day!
...
我需要在将数据集划分为训练集和测试集并将其用于逻辑回归之前,先使用单词袋或其他功能表示。
当前,我试图从上面的原始数据集中获取其他信息(tweet中的字符数;标点符号的使用,等等):
Name Nickname Age Country Reg_Date Text
Matt LeBron 63 Canada 24-12-2008 I'm in a happy mood today. I go to beach
Chris Severine 54 U.S. 15-07-2009 I stand in solidarity with #ows
Lucas Daly 47 Ireland 01-05-2020 Trump is working with Putin...
Clash Lynch 24 U.S. 13-11-2008 What a wonderful day!
...
Lulu Lulu22 18 Poland 02-09-2019 I hate Maths!!!! >(
Punctuation Positive Words Negative Words
[.] [happy] []
[#] [solidarity] []
[...] [] []
[!] [wonderful] []
[>,(] [] [hate]
现在,我真的很想了解如何以某种模型(例如在逻辑回归模型中)可以“读取”的方式来转换标点符号信息,正词,负词,文本。
如果您能给我一些有用的提示或提供示例,我将不胜感激。
答案 0 :(得分:0)
使用One hot encoding 或word embedding
有关nlp的一般信息,您可以阅读Stanford's cs224N course中的注释。更具体地说,this