亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將消息拆分為單個單詞的詞袋方法

將消息拆分為單個單詞的詞袋方法

Go
呼啦一陣風 2021-10-05 15:52:48
我試圖將一條消息拆分為單獨的單詞,并嘗試對這些消息進行標記。def split_into_tokens(message):    message = unicode(message, 'utf8')  # convert bytes into proper unicode    return TextBlob(message).wordsmessages.message.head().apply(split_into_tokens)如果顯示名稱錯誤:未定義名稱“unicode”  <ipython-input-16-98e123c365b4> in <module>()----> 1 messages.title.head().apply(split_into_tokens)C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)  3192             else:  3193                 values = self.astype(object).values->3194                 mapped = lib.map_infer(values, f, convert=convert_dtype)   3195    3196         if len(mapped) and isinstance(mapped[0], Series):pandas/_libs/src\inference.pyx in pandas._libs.lib.map_infer()<ipython-input-14-281c1d080655> in split_into_tokens(title)      1 def split_into_tokens(title):----> 2 title = unicode(title, utf8)  # convert bytes into proper       unicode      3     return TextBlob(title).wordsNameError: name 'unicode' is not defined最后它顯示未定義 unicode,我試圖更改 python 版本也仍然是同樣的問題。我是否需要在 python 插件目錄中用 str 替換 unicode ?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 223 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號