| 1 | <?php |
||
| 5 | trait NGramsTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @param array $data |
||
| 9 | * @param int $n |
||
| 10 | * @param bool $cyclic |
||
| 11 | * |
||
| 12 | * @return \Generator |
||
| 13 | */ |
||
| 14 | 3 | public function ngramsArray(array $data, $n = 1, $cyclic = true) |
|
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $data |
||
| 21 | * @param int $n |
||
| 22 | * @param bool $cyclic |
||
| 23 | * |
||
| 24 | * @return \Generator |
||
| 25 | */ |
||
| 26 | 3 | public function ngramsString($data, $n = 1, $cyclic = true) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @param $data |
||
| 35 | * @param $n |
||
| 36 | * @param $cyclic |
||
| 37 | * |
||
| 38 | * @return \Generator |
||
| 39 | */ |
||
| 40 | 6 | private function doNgrams($data, $n = 1, $cyclic = true) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @param \Generator $ngrams |
||
| 59 | * @param string $substring |
||
| 60 | * |
||
| 61 | * @return float|int |
||
| 62 | */ |
||
| 63 | public function frequency(\Generator $ngrams, $substring) { |
||
| 68 | } |
||
| 69 |
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.