-
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathTextNormalizerTest.php
58 lines (49 loc) · 1.31 KB
/
TextNormalizerTest.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
<?php
namespace Rubix\ML\Tests\Transformers;
use Rubix\ML\Datasets\Unlabeled;
use Rubix\ML\Transformers\Transformer;
use Rubix\ML\Transformers\TextNormalizer;
use PHPUnit\Framework\TestCase;
/**
* @group Transformers
* @covers \Rubix\ML\Transformers\TextNormalizer
*/
class TextNormalizerTest extends TestCase
{
/**
* @var TextNormalizer
*/
protected $transformer;
/**
* @before
*/
protected function setUp() : void
{
$this->transformer = new TextNormalizer(true);
}
/**
* @test
*/
public function build() : void
{
$this->assertInstanceOf(TextNormalizer::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'],
]);
$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'],
];
$this->assertEquals($expected, $dataset->samples());
}
}