We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ade08b commit 5be81e0Copy full SHA for 5be81e0
src/Encoding.php
@@ -7,7 +7,7 @@
7
/**
8
* Represents the output of tokenization.
9
*/
10
-readonly class Encoding
+readonly class Encoding implements \Countable
11
{
12
13
* @param int[] $ids The list of token IDs
@@ -19,4 +19,9 @@ public function __construct(
19
public array $tokens,
20
public array $typeIds = [],
21
) {}
22
+
23
+ public function count(): int
24
+ {
25
+ return \count($this->ids);
26
+ }
27
}
0 commit comments