Readability metric features

From wenmin-wu/ds-skills · View interactive version

Readability metric features is an AI agent skill from the GitHub repository wenmin-wu/ds-skills. Extracts established readability scores (Flesch, Gunning FOG, ARI, Coleman-Liau) as numeric features from text.

How to use this skill

Skill file

Readability Metric Features

Overview

Established readability formulas compute text complexity from sentence length, syllable counts, and word difficulty. Extract these as features for regression or classification tasks involving text quality, difficulty, or grade level. The textstat library provides a unified API for all major formulas.

Quick Start

import textstat

def extract_readability(text):
    return {
        "flesch_reading_ease": textstat.flesch_reading_ease(text),
        "flesch_kincaid_grade": textstat.flesch_kincaid_grade(text),
        "gunning_fog": textstat.gunning_fog(text),
        "ari": textstat.automated_readability_index(text),
        "coleman_liau": textstat.coleman_liau_index(text),
        "dale_chall": textstat.dale_chall_readability_score(text),
        "linsear_write": textstat.linsear_write_formula(text),
        "text_standard": textstat.text_standard(text, float_output=True),
    }

df["readability"] = df["text"].apply(extract_readability)
features = pd.json_normalize(df["readability"])

Workflow

  1. Install textstat (pip install textstat)
  2. Apply each readability formula to every text sample
  3. Combine scores into a feature dataframe
  4. Use as standalone features for GBDT or as auxiliary features alongside embeddings

Key Decisions

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.