PHP code example of neuron-core / tokenizer
1. Go to this page and download the library: Download neuron-core/tokenizer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
neuron-core / tokenizer example snippets
$tokenizer = new BPETokenizer();
// Initialize pre-trained tokenizer
$tokenizer->loadFrom(
__DIR__.'/../dataset/bpe-vocabulary.json',
__DIR__.'/../dataset/bpe-merges.txt'
);
// Tokenize text
$tokens = $tokenizer->encode('Hello world!');
var_dump($tokens);