MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / Encode

Method Encode

external/sentencepiece/src/char_model.cc:28–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26Model::~Model() {}
27
28EncodeResult Model::Encode(absl::string_view normalized) const {
29 if (!status().ok() || normalized.empty()) {
30 return {};
31 }
32
33 // Splits the input into character sequence
34 EncodeResult output;
35 while (!normalized.empty()) {
36 const int mblen = matcher_->PrefixMatch(normalized);
37 absl::string_view w(normalized.data(), mblen);
38 output.emplace_back(w, PieceToId(w));
39 normalized.remove_prefix(mblen);
40 }
41
42 return output;
43}
44
45} // namespace character
46} // namespace sentencepiece

Callers 9

tokenize_sentencepieceFunction · 0.45
TESTFunction · 0.45
TEST_PFunction · 0.45
mainFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
SerializeMethod · 0.45

Calls 4

okMethod · 0.80
PrefixMatchMethod · 0.80
emptyMethod · 0.45
dataMethod · 0.45

Tested by 6

TESTFunction · 0.36
TEST_PFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36