sgns::neoswarm::core::Tokenizer¶
Abstract tokenizer interface.
#include <tokenizer.hpp>
Public Functions¶
| Name | |
|---|---|
| virtual | ~Tokenizer() =default |
| virtual outcome::result< std::vector< int > > | Encode(const std::string & text) const =0 Encode text to token IDs. |
| virtual outcome::result< std::string > | Decode(const std::vector< int > & ids) const =0 Decode token IDs to text. |
| virtual bool | IsEOS(int token_id) const =0 Check whether a token ID is the end-of-sequence token. |
| virtual int | EosTokenId() const =0 |
| virtual int | BosTokenId() const =0 |
| virtual size_t | VocabSize() const =0 |
Public Functions Documentation¶
function ~Tokenizer¶
function Encode¶
Encode text to token IDs.
Parameters:
- text Input string.
Return: Token ID vector or TokenizerFailed.
function Decode¶
Decode token IDs to text.
Parameters:
- ids Token ID vector.
Return: Decoded string or TokenizerFailed.
function IsEOS¶
Check whether a token ID is the end-of-sequence token.
Parameters:
- token_id Token ID to check.
Return: True if this is the EOS token.
function EosTokenId¶
Return: The EOS token ID.
function BosTokenId¶
Return: The BOS token ID.
function VocabSize¶
Return: The vocabulary size.
Updated on 2026-10-09 at 03:59:42 +0000