pulsatrix 1.1.0
Loading...
Searching...
No Matches
pulsatrix::ReplaceDecoder Class Reference

Replaces a literal string or regex in every token (Hugging Face's Replace decoder). More...

#include <sentencepiece_bpe.hpp>

Inheritance diagram for pulsatrix::ReplaceDecoder:
Collaboration diagram for pulsatrix::ReplaceDecoder:

Public Member Functions

 ReplaceDecoder (std::string pattern, std::string content)
 
std::vector< std::string > decode_chain (std::vector< std::string > tokens) const override
 The tokens after this decoder: by default decode()'s text as one token.
 
- Public Member Functions inherited from pulsatrix::Decoder
virtual ~Decoder ()=default
 
virtual std::string decode (const std::vector< std::string > &tokens) const
 The decoded text: decode_chain() joined.
 

Static Public Member Functions

static ReplaceDecoder Regex (const std::string &pattern, std::string content)
 

Detailed Description

Replaces a literal string or regex in every token (Hugging Face's Replace decoder).

Constructor & Destructor Documentation

◆ ReplaceDecoder()

pulsatrix::ReplaceDecoder::ReplaceDecoder ( std::string  pattern,
std::string  content 
)

Member Function Documentation

◆ decode_chain()

std::vector< std::string > pulsatrix::ReplaceDecoder::decode_chain ( std::vector< std::string >  tokens) const
overridevirtual

The tokens after this decoder: by default decode()'s text as one token.

Reimplemented from pulsatrix::Decoder.

◆ Regex()

static ReplaceDecoder pulsatrix::ReplaceDecoder::Regex ( const std::string &  pattern,
std::string  content 
)
static

The documentation for this class was generated from the following file: