/** * Gives the Spache readability score of text entered rounded to one digit * @param boolean|string $strText Text to be checked * @return int|float */ public function spacheReadabilityScore($strText = false) { $strText = $this->setText($strText); $score = Maths::bcCalc(Maths::bcCalc(Maths::bcCalc(0.121, '*', Maths::bcCalc(Text::wordCount($strText, $this->strEncoding), '/', Text::sentenceCount($strText, $this->strEncoding))), '+', Maths::bcCalc(0.082, '*', $this->spacheDifficultWordCount($strText))), '+', 0.659); if ($this->normalise) { return Maths::normaliseScore($score, 0, 5, $this->dps); // Not really suitable for measuring readability above grade 4 } else { return Maths::bcCalc($score, '+', 0, true, $this->dps); } }