情绪分析联合lis

2024-10-17 08:37:15 发布

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

我正在用scikit learn python进行情绪分析,现在我正在使用nltk来进行单词lemmatization,以提高处理速度,例如:

我在nltk处理后得到以下数组:

array([ ['Really', 'a', 'terrible', 'course', u'lecture', u'be', 'so', 'boring', 'i', u'contemplate', 'suicide', 'on', 'numerous', u'occasion', 'and', 'the', 'tutes', u'go', 'for', 'two', u'hour', 'and', u'be', 'completely'], ['Management', 'accounting', u'require', 'sufficient', 'practice', 'to', 'get', 'a', 'hang', 'of', 'Made', 'easier', 'with', 'a', 'great', 'lecturer']], dtype=object)

但是scklearn要求数组是

array([ 'Really a terrible course  lectures were so boring i contemplated suicide on numerous occasions and the tutes went for two hours and were completely ', 'Management accounting requires sufficient practice to get a hang of  Made easier with a great lecturer '],dtype=object)

那么,将这个数组转换成正确形式的最佳方法是什么呢?我尝试使用joint list,但结果很奇怪


Tags: andthesoon数组bearraynltk