distribution_score

Function distribution_score 

Source
pub fn distribution_score(text: &str) -> f64
Expand description

Returns a “score” in (0, 1] that describes how well the given text’s letter frequencies fit the same distribution as standard English. A higher score (closer to 1) indicates the text’s frequency is closer to English.

Note that this only scores the distribution itself, not the actual letter frequencies. For example, a simple monoalphabetic substitution cipher would get an almost perfect score, since the frequency distribution is unchanged from the plaintext.

§Parameters

  • text - The text to get the distribution score of.

§Returns

The frequency distribution fitness score, in (0, 1].