可读性测试

Python 中的 NLP 特征工程

Rounak Banik

Data Scientist

可读性测试概览

  • 判断英语段落的可读性
  • 量表从小学到大学毕业
  • 基于词、音节与句子计数的公式
  • 用于虚假新闻和水军评论检测
Python 中的 NLP 特征工程

可读性测试示例

  • Flesch 阅读容易度
  • Gunning 雾指数
  • 简明胡言指数(SMOG)
  • Dale–Chall 分数
Python 中的 NLP 特征工程

可读性测试示例

  • Flesch 阅读容易度
  • Gunning 雾指数
  • 简明胡言指数(SMOG)
  • Dale–Chall 分数
Python 中的 NLP 特征工程

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 中的 NLP 特征工程

Flesch 阅读容易度分数解读

阅读容易度分数 年级水平
90-100 5
80-90 6
70-80 7
60-70 8-9
50-60 10-12
30-50 大学
0-30 大学毕业
Python 中的 NLP 特征工程

Gunning 雾指数

  • 1954 年提出
  • 也依赖平均句长
  • 复杂词占比越高,文本越难读
  • 指数越高,可读性越低
Python 中的 NLP 特征工程

Gunning 雾指数解读

雾指数 年级水平
17 大学毕业
16 大学四年级
15 大学三年级
14 大学二年级
13 大学一年级
12 高中三年级
11 高中二年级
雾指数 年级水平
10 高中一年级
9 初三
8 初二
7 初一
6 小学六年级
Python 中的 NLP 特征工程

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 中的 NLP 特征工程

Ayo berlatih!

Python 中的 NLP 特征工程

Preparing Video For Download...