(Python 的自然語言處理工具組,Natural Language ToolKit)是一個非常有用的
程式庫,它可以用在自然語言處理以及文字分類
6
等任務之上。它也包含許多語料庫,能
夠讓你用來訓練以及測試。其中一個是
movie_reviews
語料庫
7
,若你只是想要學習如何
作情緒分類,那麼這個語料庫可以是一個很好的開始。它由兩個目錄組成:
pos
與
neg
。
在每個目錄中則是包含電影評論的一組檔案,每個評論之間都是被一行空白行所分隔。
這個語料庫是由Pang 與Lee
8
所建立的,他們使用跟隨著每個評論的評分,來決定這個
評論要放在
pos
或是
neg
中。所以在一個5顆星的評論系統中,3.5 顆星或是更高的評
分將會被放在
pos
目錄中,而2.5 顆星或是更低的評分則會放在
neg
目錄中。這個方式
背後的假設是,較高分的評論會擁有正面的語言,而較低分的評論則會擁有較多的負面
語言。被分成兩個部分的語言對文字分類來說是最理想的,因為這樣分類器便能夠更精
確的學習有哪些字代表
pos
,而有哪些字代表
neg
。
因為我需要對本地企業作情緒分析,而不是電影,所以我使用一個類似的方法,來建立
給本地企業評論的情緒訓練語料庫。從一些被選出來的企業中,我從5顆星的評論中
產生
pos
的文字,而從1顆星的評論中產生
neg
的文字。實際上,在一開始的時候,我
會用4顆星與 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.