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

Function IsStructurallyValid

external/sentencepiece/src/util.cc:105–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105bool IsStructurallyValid(absl::string_view str) {
106 const char *begin = str.data();
107 const char *end = str.data() + str.size();
108 size_t mblen = 0;
109 while (begin < end) {
110 const char32 c = DecodeUTF8(begin, end, &mblen);
111 if (c == kUnicodeError && mblen != 3) return false;
112 if (!IsValidCodepoint(c)) return false;
113 begin += mblen;
114 }
115 return true;
116}
117
118size_t EncodeUTF8(char32 c, char *output) {
119 if (c <= 0x7F) {

Callers 2

CompileCharsMapMethod · 0.85
TESTFunction · 0.85

Calls 4

IsValidCodepointFunction · 0.85
DecodeUTF8Function · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68