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

Replaces every match of a literal string or a regex (Hugging Face's Replace normalizer). More...

#include <sentencepiece_bpe.hpp>

Inheritance diagram for pulsatrix::ReplaceNormalizer:
Collaboration diagram for pulsatrix::ReplaceNormalizer:

Public Member Functions

 ReplaceNormalizer (std::string pattern, std::string content)
 A literal pattern.
 
void normalize (NormalizedString &text) const override
 
- Public Member Functions inherited from pulsatrix::Normalizer
virtual ~Normalizer ()=default
 

Static Public Member Functions

static ReplaceNormalizer Regex (const std::string &pattern, std::string content)
 A regex pattern.
 

Detailed Description

Replaces every match of a literal string or a regex (Hugging Face's Replace normalizer).

Constructor & Destructor Documentation

◆ ReplaceNormalizer()

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

A literal pattern.

Exceptions
std::invalid_argumentif it's empty.

Member Function Documentation

◆ normalize()

void pulsatrix::ReplaceNormalizer::normalize ( NormalizedString &  text) const
overridevirtual

Implements pulsatrix::Normalizer.

◆ Regex()

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

A regex pattern.


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