Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
48 | private function getNgrams(array $match, int $n = 2): array |
||
49 | { |
||
50 | $ngrams = []; |
||
51 | $len = count($match); |
||
52 | for ($i = 0; $i < $len; $i++) { |
||
53 | if ($i > ($n - 2)) { |
||
54 | $ng = ''; |
||
55 | for ($j = $n - 1; $j >= 0; $j--) { |
||
56 | $ng .= ' '.$match[$i - $j]; |
||
57 | } |
||
58 | $ngrams[] = trim($ng); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | return $ngrams; |
||
63 | } |
||
65 |