可讀性測試

Python 中文本特徵工程

Rounak Banik

Data Scientist

可讀性測試概觀

  • 判定英文段落的可讀性
  • 等級範圍從小學到大學畢業
  • 以字詞、音節、句子數計算的數學公式
  • 應用於假新聞與意見垃圾偵測
Python 中文本特徵工程

可讀性文字範例

  • Flesch 閱讀容易度
  • Gunning 霧指數
  • SMOG(Simple Measure of Gobbledygook)
  • Dale-Chall 分數
Python 中文本特徵工程

可讀性測試範例

  • Flesch 閱讀容易度
  • Gunning 霧指數
  • SMOG(Simple Measure of Gobbledygook)
  • Dale-Chall 分數
Python 中文本特徵工程

Flesch 閱讀容易度

  • 最早且最常用的測試之一
  • 平均句長越長,越難讀
    • 「This is a short sentence.」
    • 「This is longer sentence with more words and it is harder to follow than the first sentence.」
  • 單字的平均音節數越多,越難讀
    • 「I live in my home.」
    • 「I reside in my domicile.」
  • 分數越高,可讀性越好
Python 中文本特徵工程

Flesch 分數解讀

閱讀容易度分數 年級
90-100 5
80-90 6
70-80 7
60-70 8-9
50-60 10-12
30-50 大學
0-30 大學畢業
Python 中文本特徵工程

Gunning 霧指數

  • 1954 年提出
  • 亦受平均句長影響
  • 複雜字比例越高,越難讀
  • 指數越高,可讀性越低
Python 中文本特徵工程

Gunning 霧指數解讀

霧指數 年級
17 大學畢業
16 大四
15 大三
14 大二
13 大一
12 高三
11 高二
霧指數 年級
10 高一
9 國三
8 國二
7 國一
6 小六
Python 中文本特徵工程

readability 函式庫

# Download nltk punkt module
import nltk
nltk.download('punkt_tab')
# Import the Readability class
from readability import Readability

# Create a Readability Object readability_scores = Readability(text)
# Generate scores gf = readability_scores.gunning_fog() print(gf.score())
16.26
Python 中文本特徵工程

一起來練習吧!

Python 中文本特徵工程

Preparing Video For Download...