Skip to main content

Traditional Chinese sentiment analysis tool based on BERT.

Project description

senti_c (sentiment analysis toolkit for traditional Chinese)

簡介

本工具為繁體中文情感分析套件,支援三種類型分析:句子情感分類、屬性術語提取、屬性情感分類;同時提供函數供使用者應用其它資料重新微調模型。

目錄


執行環境

  • python3.8

安裝方式

1.pip

pip install senti_c 

2.from source

git clone https://github.com/hsinmin/senti_c
cd senti_c
python3 setup.py install

功能介紹

1.句子情感分類:預測

from senti_c import SentenceSentimentClassification

sentence_classifier = SentenceSentimentClassification()

test_data = ["我很喜歡這家店!超級無敵棒!","這個服務生很不親切..."]  
result = sentence_classifier.predict(test_data,run_split=True,aggregate_strategy=False)  # 可依據需求調整參數
  • 結果如下:

avatar

2.句子情感分類:重新微調模型

from senti_c import SentenceSentimentModel

sentence_classifier = SentenceSentimentModel()
sentence_classifier.train(data_dir="./data/sentence_data",output_dir="test_fine_tuning_sent")  # 可依據需求調整參數

3.屬性情感分析:預測

from senti_c import AspectSentimentAnalysis

aspect_classifier = AspectSentimentAnalysis()

test_data = ["我很喜歡這家店!超級無敵棒!","這個服務生很不親切..."]   
result = aspect_classifier.predict(test_data,output_result="all")  # 可依據需求調整參數
  • 結果如下:

avatar

avatar

avatar

avatar

4.屬性情感分析:重新微調模型

from senti_c import AspectSentimentModel

aspect_classifier = AspectSentimentModel()
aspect_classifier.train(data_dir="./data/aspect_data",output_dir="test_fine_tuning_aspect")  # 可依據需求調整參數

範例程式

相關功能demo可參考examples資料夾中的function_demo檔案。

資料

本研究蒐集Google評論上餐廳與飯店領域評論內容、並進行句子情感分類、屬性情感分析標記 (屬性標記與情感標記)。

單位

本工具之開發人員為國立台灣大學資訊管理學系資訊分析與經濟效果研究實驗室的成員。 主要參與人員為凃育婷(flywinglan@gmail.com)與盧信銘(luim@ntu.edu.tw)。 網址: http://www.im.ntu.edu.tw/~lu/index.htm

引用

如果你使用本工具,請引用以下碩士論文:
凃育婷(2020)。基於順序遷移學習開發繁體中文情感分析工具。國立臺灣大學資訊管理學研究所碩士論文,台北市。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

senti_c-0.1.4.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

senti_c-0.1.4-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file senti_c-0.1.4.tar.gz.

File metadata

  • Download URL: senti_c-0.1.4.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for senti_c-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3db2c836e44bbe2d570e8e8c4d9745007e5eb5549db5d8de56953b4a1f95977d
MD5 4aa5303a3d237ed5215928448968f797
BLAKE2b-256 57953f4defe474bc5e9831f5cc887a35dc8752d7d7aa3c6de65f7d30bea6d789

See more details on using hashes here.

File details

Details for the file senti_c-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: senti_c-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 48.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for senti_c-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0aea3ea92e6b7b41c2352c30009348a903d687799c8fa10206151929a5c19b11
MD5 e74ff6c1a5f4b47d0ab567b0c381a1a3
BLAKE2b-256 6412ce268b32f6f75ed87be2dcafdb6181fe84a89d9839f45c69a7cba2194b34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page