#include "normalizer.h"
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
#include "absl/strings/strip.h"
#include "common.h"
#include "third_party/darts_clone/darts.h"
#include "util.h"
namespace sentencepiece {
namespace normalizer {
constexpr int Normalizer::kMaxTrieResultsSize;
Normalizer::Normalizer(const NormalizerSpec& spec,
const TrainerSpec& trainer_spec)
: … { … }
Normalizer::Normalizer(const NormalizerSpec& spec)
: … { … }
Normalizer::~Normalizer() { … }
void Normalizer::Init() { … }
util::Status Normalizer::Normalize(absl::string_view input,
std::string* normalized,
std::vector<size_t>* norm_to_orig) const { … }
std::string Normalizer::Normalize(absl::string_view input) const { … }
std::pair<absl::string_view, int> Normalizer::NormalizePrefix(
absl::string_view input) const { … }
std::string Normalizer::EncodePrecompiledCharsMap(
absl::string_view trie_blob, absl::string_view normalized) { … }
util::Status Normalizer::DecodePrecompiledCharsMap(
absl::string_view blob,
absl::string_view* trie_blob,
absl::string_view* normalized,
std::string* buffer) { … }
PrefixMatcher::PrefixMatcher(const std::set<absl::string_view> &dic) { … }
int PrefixMatcher::PrefixMatch(absl::string_view w, bool *found) const { … }
std::string PrefixMatcher::GlobalReplace(absl::string_view w,
absl::string_view out) const { … }
}
}