Skip to content

Commit

Permalink
add encode example
Browse files Browse the repository at this point in the history
  • Loading branch information
danny50610 committed Aug 25, 2023
1 parent 51fcfc3 commit cf8f384
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ use Danny50610\BpeTokeniser\EncodingFactory;

$enc = EncodingFactory::createByEncodingName('cl100k_base');

var_dump($enc->encode("hello world"));
/**
* output:
* array(2) {
* [0]=>
* int(15339)
* [1]=>
* int(1917)
* }
*/

var_dump($enc->decode($enc->encode("hello world")));
// output: string(11) "hello world"
```
Expand Down

0 comments on commit cf8f384

Please sign in to comment.