1 | <?php |
||
8 | class NGramsCyclicSpec extends ObjectBehavior |
||
9 | { |
||
10 | public function it_is_initializable() |
||
11 | { |
||
12 | $this->shouldHaveType(NGramsCyclic::class); |
||
13 | } |
||
14 | |||
15 | public function it_can_get_ngram_from_an_array_without_cycling() |
||
16 | { |
||
17 | $result = [ |
||
18 | ['h', 'e', 'l', 'l'], |
||
19 | ['e', 'l', 'l', 'o'], |
||
20 | ['l', 'l', 'o', ' '], |
||
21 | ['l', 'o', ' ', 'w'], |
||
22 | ['o', ' ', 'w', 'o'], |
||
23 | [' ', 'w', 'o', 'r'], |
||
24 | ['w', 'o', 'r', 'l'], |
||
25 | ['o', 'r', 'l', 'd'], |
||
26 | ['r', 'l', 'd', 'h'], |
||
27 | ['l', 'd', 'h', 'e'], |
||
28 | ['d', 'h', 'e', 'l'], |
||
29 | ]; |
||
30 | |||
31 | $this->ngrams(['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'], 4)->shouldIterateAs(new \ArrayIterator($result)); |
||
32 | } |
||
33 | } |
||
34 |