24 lines
333 B
PHP
24 lines
333 B
PHP
<?php
|
|
|
|
class OCR extends Model {
|
|
|
|
public function get_words() {
|
|
$t = new Text($this->body);
|
|
return $t->words();
|
|
}
|
|
|
|
public function count_words() {
|
|
$words = $this->get_words();
|
|
|
|
$counted = [];
|
|
|
|
foreach ($words as $word) {
|
|
if (strlen($word) > 2) {
|
|
@$counted[strtoupper($word)] ++;
|
|
}
|
|
}
|
|
|
|
return $counted;
|
|
}
|
|
}
|