|
6 | 6 |
|
7 | 7 | it('creates an entity from a decoded payload', function () { |
8 | 8 | $entity = Entity::from([ |
9 | | - 'entity_group' => 'email', |
| 9 | + 'entity_group' => 'private_email', |
10 | 10 | 'start' => 20, |
11 | 11 | 'end' => 36, |
12 | 12 | 'score' => 0.9876, |
13 | 13 | 'text' => 'ignored@example.com', |
14 | 14 | ], 'Contact John Doe at jdoe@example.com.'); |
15 | 15 |
|
16 | | - expect($entity->type)->toBe('email') |
| 16 | + expect($entity->type)->toBe('private_email') |
17 | 17 | ->and($entity->text)->toBe('jdoe@example.com') |
18 | 18 | ->and($entity->start)->toBe(20) |
19 | 19 | ->and($entity->end)->toBe(36) |
|
22 | 22 |
|
23 | 23 | it('creates an entity from alternate type keys', function () { |
24 | 24 | $entity = Entity::from([ |
25 | | - 'label' => 'person', |
| 25 | + 'label' => 'private_person', |
26 | 26 | 'start' => 8, |
27 | 27 | 'end' => 16, |
28 | 28 | 'score' => 0.9876, |
29 | 29 | ], 'Contact John Doe today.'); |
30 | 30 |
|
31 | | - expect($entity->type)->toBe('person') |
| 31 | + expect($entity->type)->toBe('private_person') |
32 | 32 | ->and($entity->text)->toBe('John Doe'); |
33 | 33 | }); |
34 | 34 |
|
35 | 35 | it('exposes entity details as arrays and json', function () { |
36 | 36 | $entity = new Entity( |
37 | | - type: 'email', |
| 37 | + type: 'private_email', |
38 | 38 | start: 20, |
39 | 39 | end: 36, |
40 | 40 | score: 0.9876, |
|
43 | 43 |
|
44 | 44 | expect($entity->length())->toBe(16) |
45 | 45 | ->and($entity->toArray())->toBe([ |
46 | | - 'type' => 'email', |
| 46 | + 'type' => 'private_email', |
47 | 47 | 'start' => 20, |
48 | 48 | 'end' => 36, |
49 | 49 | 'score' => 0.9876, |
|
78 | 78 |
|
79 | 79 | it('throws an exception when the decoded payload is invalid', function () { |
80 | 80 | Entity::from([ |
81 | | - 'entity_group' => 'email', |
| 81 | + 'entity_group' => 'private_email', |
82 | 82 | 'start' => 20, |
83 | 83 | 'end' => 200, |
84 | 84 | 'score' => 0.9876, |
|
0 commit comments