Skip to main content

A sentiment analysis package used for traditional Chinese.

Project description

senti_c (sentiment analysis toolkit for traditional Chinese)

簡介

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

目錄


執行環境

  • python3.7

安裝方式

  1. pip
pip install senti_c 
  1. from source
git clone https://github.com/julielanblue/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)  # 可依據需求調整參數
  • 結果如下:

Sample

  1. 句子情感分類:重新微調模型
from senti_c import SentenceSentimentModel

sentence_classifier = SentenceSentimentModel()
sentence_classifier.train(data_dir="./data/sentence_data",output_dir="test_fine_tuning_sent")  # 可依據需求調整參數
  1. 屬性情感分析:預測
from senti_c import AspectSentimentAnalysis

aspect_classifier = AspectSentimentAnalysis()

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

Sample

Sample

Sample

Sample

  1. 屬性情感分析:重新微調模型
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資料夾。

引用

引用請註記來源:NTU BAEIR lab

致謝

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

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.0.3.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

senti_c-0.0.3-py3-none-any.whl (48.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: senti_c-0.0.3.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for senti_c-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f2793a9b7d7002558836550f5407c5b29c2e1b1b11a931c2e1d6e445f29a0afe
MD5 dd0bc7ec92e526f7227c38dfdaa0baa9
BLAKE2b-256 b314792aa5f7da015377898dc9b199aea9ed378da3db75c73e92a6c08bfad1f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: senti_c-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 48.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5

File hashes

Hashes for senti_c-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dabdb1eaf59e4cb10ce262f4c11dcfef6dc91f20f7dbc1911f451f2477cc7f8a
MD5 88e76c92fdd6a674fa9271a2646a6ccc
BLAKE2b-256 38310fcc1a0064e95263bdfbda4e6f862700592e6bf469e08838db38ffeed961

See more details on using hashes here.

Supported by

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