| @@ 226-261 (lines=36) @@ | ||
| 223 | * @param boolean|string $strText Text to be checked |
|
| 224 | * @return int|float |
|
| 225 | */ |
|
| 226 | public function colemanLiauIndex($strText = false) |
|
| 227 | { |
|
| 228 | $strText = $this->setText($strText); |
|
| 229 | ||
| 230 | $score = Maths::bcCalc( |
|
| 231 | Maths::bcCalc( |
|
| 232 | Maths::bcCalc( |
|
| 233 | 5.89, |
|
| 234 | '*', |
|
| 235 | Maths::bcCalc( |
|
| 236 | Text::letterCount($strText, $this->strEncoding), |
|
| 237 | '/', |
|
| 238 | Text::wordCount($strText, $this->strEncoding) |
|
| 239 | ) |
|
| 240 | ), |
|
| 241 | '-', |
|
| 242 | Maths::bcCalc( |
|
| 243 | 0.3, |
|
| 244 | '*', |
|
| 245 | Maths::bcCalc( |
|
| 246 | Text::sentenceCount($strText, $this->strEncoding), |
|
| 247 | '/', |
|
| 248 | Text::wordCount($strText, $this->strEncoding) |
|
| 249 | ) |
|
| 250 | ) |
|
| 251 | ), |
|
| 252 | '-', |
|
| 253 | 15.8 |
|
| 254 | ); |
|
| 255 | ||
| 256 | if ($this->normalise) { |
|
| 257 | return Maths::normaliseScore($score, 0, $this->maxGradeLevel, $this->dps); |
|
| 258 | } else { |
|
| 259 | return Maths::bcCalc($score, '+', 0, true, $this->dps); |
|
| 260 | } |
|
| 261 | } |
|
| 262 | ||
| 263 | /** |
|
| 264 | * Gives the SMOG Index of text entered rounded to one digit |
|
| @@ 306-341 (lines=36) @@ | ||
| 303 | * @param boolean|string $strText Text to be checked |
|
| 304 | * @return int|float |
|
| 305 | */ |
|
| 306 | public function automatedReadabilityIndex($strText = false) |
|
| 307 | { |
|
| 308 | $strText = $this->setText($strText); |
|
| 309 | ||
| 310 | $score = Maths::bcCalc( |
|
| 311 | Maths::bcCalc( |
|
| 312 | 4.71, |
|
| 313 | '*', |
|
| 314 | Maths::bcCalc( |
|
| 315 | Text::letterCount($strText, $this->strEncoding), |
|
| 316 | '/', |
|
| 317 | Text::wordCount($strText, $this->strEncoding) |
|
| 318 | ) |
|
| 319 | ), |
|
| 320 | '+', |
|
| 321 | Maths::bcCalc( |
|
| 322 | Maths::bcCalc( |
|
| 323 | 0.5, |
|
| 324 | '*', |
|
| 325 | Maths::bcCalc( |
|
| 326 | Text::wordCount($strText, $this->strEncoding), |
|
| 327 | '/', |
|
| 328 | Text::sentenceCount($strText, $this->strEncoding) |
|
| 329 | ) |
|
| 330 | ), |
|
| 331 | '-', |
|
| 332 | 21.43 |
|
| 333 | ) |
|
| 334 | ); |
|
| 335 | ||
| 336 | if ($this->normalise) { |
|
| 337 | return Maths::normaliseScore($score, 0, $this->maxGradeLevel, $this->dps); |
|
| 338 | } else { |
|
| 339 | return Maths::bcCalc($score, '+', 0, true, $this->dps); |
|
| 340 | } |
|
| 341 | } |
|
| 342 | ||
| 343 | /** |
|
| 344 | * Gives the Dale-Chall readability score of text entered rounded to one digit |
|
| @@ 348-383 (lines=36) @@ | ||
| 345 | * @param boolean|string $strText Text to be checked |
|
| 346 | * @return int|float |
|
| 347 | */ |
|
| 348 | public function daleChallReadabilityScore($strText = false) |
|
| 349 | { |
|
| 350 | $strText = $this->setText($strText); |
|
| 351 | ||
| 352 | $score = Maths::bcCalc( |
|
| 353 | Maths::bcCalc( |
|
| 354 | 0.1579, |
|
| 355 | '*', |
|
| 356 | Maths::bcCalc( |
|
| 357 | 100, |
|
| 358 | '*', |
|
| 359 | Maths::bcCalc( |
|
| 360 | $this->daleChallDifficultWordCount($strText), |
|
| 361 | '/', |
|
| 362 | Text::wordCount($strText, $this->strEncoding) |
|
| 363 | ) |
|
| 364 | ) |
|
| 365 | ), |
|
| 366 | '+', |
|
| 367 | Maths::bcCalc( |
|
| 368 | 0.0496, |
|
| 369 | '*', |
|
| 370 | Maths::bcCalc( |
|
| 371 | Text::wordCount($strText, $this->strEncoding), |
|
| 372 | '/', |
|
| 373 | Text::sentenceCount($strText, $this->strEncoding) |
|
| 374 | ) |
|
| 375 | ) |
|
| 376 | ); |
|
| 377 | ||
| 378 | if ($this->normalise) { |
|
| 379 | return Maths::normaliseScore($score, 0, 10, $this->dps); |
|
| 380 | } else { |
|
| 381 | return Maths::bcCalc($score, '+', 0, true, $this->dps); |
|
| 382 | } |
|
| 383 | } |
|
| 384 | ||
| 385 | /** |
|
| 386 | * Gives the Spache readability score of text entered rounded to one digit |
|