//! Shared statistics helpers used by multiple formulas.
usecrate::text::TextStatistics;/// Helpers over [`TextStatistics`].
pubstructTextStatisticsHelper;implTextStatisticsHelper{/// Estimate the percentage of "difficult" words (all words that are not
/// monosyllabic), used by Dale-Chall and Spache.
pubfnestimate_difficult_percentage(stats:&TextStatistics)->f64{if stats.word_count ==0{return0.0;}let easy = stats.syllable_histogram.get(&1).copied().unwrap_or(0);letmut difficult = stats.word_count - easy;if difficult <0{
difficult =0;}(difficult asf64/ stats.word_count asf64)*100.0}}