Skip to main content

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評論上餐廳與飯店領域評論內容、並進行句子情感分類、屬性情感分析標記 (屬性標記與情感標記)。

相關資料格式請見data資料夾。

引用

1.論文:
凃育婷(2020)。基於順序遷移學習開發繁體中文情感分析工具。國立臺灣大學資訊管理學研究所碩士論文,台北市。

2.實驗室:
Business Analytics and Economic Impact Research Lab
Department of Information Management
National Taiwan University
http://www.im.ntu.edu.tw/~lu/index.htm

致謝

本套件基於 Hugging Face 團隊開源的 transformers。

Metadata

Release files for senti-c 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for senti-c 0.1.1
File Size Uploaded Provenance
senti_c-0.1.1.tar.gz 39.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for senti-c 0.1.1
File Interpreter ABI Platform
senti_c-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 88.5 kB

Release files / senti_c-0.1.1.tar.gz

Download URL senti_c-0.1.1.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2bab0389e2efdd55dec1540818e6c64cca71b5b67160b9bc44c26c18de050e4b
BLAKE2b-256 checksum
How to use checksums
6e856202225e86c212b1a3b0c16916062c871cb4fcc88de392f42448340ac2a3
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / senti_c-0.1.1-py3-none-any.whl

Download URL senti_c-0.1.1-py3-none-any.whl
Size 48.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
728aee0cd8433437cd8b09ee3e715b4d62aaa6cd0d8f8e170afabff9431b079c
BLAKE2b-256 checksum
How to use checksums
5ad320de26bd81fbcd0aa1c642d02ed5679c95599bc346764912331fd5c7516c
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for senti-c 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page