Metadata-Version: 2.1
Name: senti-c
Version: 0.0.2
Summary: A sentiment analysis package used for traditional Chinese.
Home-page: https://github.com/julielanblue/senti_c
Author: Julie Tu
Author-email: flywinglan@gmail.com
License: MIT
Keywords: sentiment analysis toolkit
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.7
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: opencc
Requires-Dist: numpy
Requires-Dist: torch
Requires-Dist: transformers
Requires-Dist: pandas
Requires-Dist: scikit-learn
Requires-Dist: tensorflow (>=2.2.0)

# senti_c (sentiment analysis toolkit for traditional Chinese)

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

## 目錄
* [安裝方式](#安装方式)
* [功能介紹](#功能介紹)
* [範例程式](#範例程式)
* [資料](#資料)

---

## 執行環境
* python3.7 

## 安裝方式
1. pip 

```bash
pip install senti_c 
```

2. from source

```bash
git clone https://github.com/julielanblue/senti_c
cd senti_c
python3 setup.py install
```

## 功能介紹
1. 句子情感分類：**預測**

```bash
from senti_c import SentenceSentimentClassification

sentence_classifier = SentenceSentimentClassification()

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

* 結果如下：

<p align="center">
    <img src="https://github.com/julielanblue/senti_c-result-files/blob/master/%E5%8F%A5%E5%AD%90%E7%B5%90%E6%9E%9C.jpg" alt="Sample" >
</p>


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

```bash
from senti_c import SentenceSentimentModel

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


3. 屬性情感分析：**預測**

```bash
from senti_c import AspectSentimentAnalysis

aspect_classifier = AspectSentimentAnalysis()

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

<p align="center">
    <img src="https://github.com/julielanblue/senti_c-result-files/blob/master/%E5%B1%AC%E6%80%A7%E7%B5%90%E6%9E%9C1.jpg" alt="Sample"  width="500" height="300">
</p>
<p align="center">
    <img src="https://github.com/julielanblue/senti_c-result-files/blob/master/%E5%B1%AC%E6%80%A7%E7%B5%90%E6%9E%9C2.jpg" alt="Sample"  width="500" height="300">
</p>
<p align="center">
    <img src="https://github.com/julielanblue/senti_c-result-files/blob/master/%E5%B1%AC%E6%80%A7%E7%B5%90%E6%9E%9C3.jpg" alt="Sample"  width="500" height="300">
</p>
<p align="center">
    <img src="https://github.com/julielanblue/senti_c-result-files/blob/master/%E5%B1%AC%E6%80%A7%E7%B5%90%E6%9E%9C4.jpg" alt="Sample"  width="500" height="300">
</p>


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

```bash
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 團隊開源的 <a href="https://github.com/huggingface/transformers">transformers</a>。 













