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

Function tokenize_space_language

src/models/qwen3_forced_aligner/processor.cpp:112–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111 }
112 if (!buffer.empty()) {
113 out.push_back(buffer);
114 }
115 return out;
116}
117
118std::vector<std::string> tokenize_space_language(const std::string & text) {
119 std::vector<std::string> words;
120 std::string segment;
121 auto flush = [&]() {
122 if (segment.empty()) {
123 return;
124 }
125 const auto cleaned = clean_token(segment);
126 if (!cleaned.empty()) {
127 auto split = split_segment_with_chinese(cleaned);
128 words.insert(words.end(), split.begin(), split.end());
129 }
130 segment.clear();
131 };
132 for (const auto & ch : utf8_chars(text)) {
133 if (ch.codepoint == ' ' || ch.codepoint == '\t' || ch.codepoint == '\n' || ch.codepoint == '\r') {
134 flush();
135 } else {
136 segment += ch.text;
137 }
138 }

Callers 1

build_promptMethod · 0.85

Calls 7

clean_tokenFunction · 0.85
utf8_charsFunction · 0.85
emptyMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected