# Predetect with Pinyin
## 作法
- 訊息進入結巴斷詞前,將整句訊息轉換成拼音格式,並透過拼音禁字表檢測此拼音訊息包含哪些禁詞
- 將搜尋到的結果放到輸出的 dataframe 中
## 範例
```
輸入: '糙ni馬的習進平'
輸出: ['(习近平, 1)', '(马的, 2)']
輸入: '糙ni馬的習近平'
輸出: ['(习近平, 1)', '(马的, 2)']
輸入: '糙ni他馬的習進平安夜64六四'
輸出: ['(习近平, 1)', '(六四, 1)', '(64, 1)', '(马的, 2)', '(他马的, 2)']
```
[檢視表單](https://docs.google.com/spreadsheets/d/1aYoR-Wd-3-g-ebeCttsL5i8jaAiNQaA48V6l8GL1Me4/edit?usp=sharing)

## 耗時
### With pinyin predetected
| Step | Volume | Time |
| ------------------------------------------------------------------------ | ------ | ---------------- |
| Predicting zh-message label, detecting rule-based word, detecting pinyin | 4480it | 22:02, 3.39it/s |
### Without pinyin predetected
| Step | Volume | Time |
| ------------------------------------------------------------------------ | ------ | ---------------- |
| Predicting zh-message label, detecting rule-based word, detecting pinyin | 4480it | 21:09, 3.53it/s |
## 測試結果分析
### 資料過濾過程
```
原始資料數 (9980)
-> Pinyin Predetected 不為空且不重複的數量 (1665)
-> 刪除內容相似資料後之數量 (48)
```
[google sheet](https://docs.google.com/spreadsheets/d/1g3059JWfGLrBjr7oHFc1iPdPJyQesLS2CvtFwr5-He4/edit?usp=sharing)
### 人工分析結果 (與結巴切詞結果不同 18筆)
- Predetect 結果也許能修正切詞的資料 (7筆)

- Predetect 結果無法修正切詞的資料 (部分偏離詞的原意) (11筆)

### 優劣分析
以此資料集檢測出的結果,可用來修正切詞且不重複的僅有 7 個詞,而可能造成詞偏離原意且不重複的則有 11 個詞