-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathMultibyteTextNormalizerTest.php
68 lines (58 loc) · 1.72 KB
/
MultibyteTextNormalizerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace Rubix\ML\Tests\Transformers;
use Rubix\ML\Datasets\Unlabeled;
use Rubix\ML\Transformers\MultibyteTextNormalizer;
use Rubix\ML\Transformers\Transformer;
use PHPUnit\Framework\TestCase;
/**
* @group Transformers
* @covers \Rubix\ML\Transformers\MultibyteTextNormalizer
*/
class MultibyteTextNormalizerTest extends TestCase
{
/**
* @var Unlabeled
*/
protected $dataset;
/**
* @var MultibyteTextNormalizer
*/
protected $transformer;
/**
* @before
*/
protected function setUp() : void
{
$this->transformer = new MultibyteTextNormalizer(false);
}
/**
* @test
*/
public function build() : void
{
$this->assertInstanceOf(MultibyteTextNormalizer::class, $this->transformer);
$this->assertInstanceOf(Transformer::class, $this->transformer);
}
/**
* @test
*/
public function transform() : void
{
$dataset = Unlabeled::quick([
['The quick brown fox jumped over the lazy man sitting at a bus'
. ' stop drinking a can of Coke'],
['with a Dandy umbrella'],
['Depuis qu’il avait emménagé à côté de chez elle, il y a de ça cinq ans.'],
['Working with emoji 🤓'],
]);
$dataset->apply($this->transformer);
$expected = [
['the quick brown fox jumped over the lazy man sitting at a bus'
. ' stop drinking a can of coke'],
['with a dandy umbrella'],
['depuis qu’il avait emménagé à côté de chez elle, il y a de ça cinq ans.'],
['working with emoji 🤓'],
];
$this->assertEquals($expected, $dataset->samples());
}
}