MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / tokenize

Function tokenize

app/src/AI/DocSearch.cpp:58–75  ·  view source on GitHub ↗

* @brief Tokenizer mirrors the Python build script: word chars, lowercased. */

Source from the content-addressed store, hash-verified

56 * @brief Tokenizer mirrors the Python build script: word chars, lowercased.
57 */
58static QStringList tokenize(const QString& text)
59{
60 static const QRegularExpression re(QStringLiteral("[A-Za-z][A-Za-z0-9_]+"));
61 QStringList out;
62 auto it = re.globalMatch(text);
63 while (it.hasNext()) {
64 const auto m = it.next();
65 auto t = m.captured(0).toLower();
66 if (t.size() <= 1)
67 continue;
68
69 if (stopwords().contains(t))
70 continue;
71
72 out.append(t);
73 }
74 return out;
75}
76
77/**
78 * @brief Singleton accessor. Index loads on first call.

Callers 1

searchMethod · 0.70

Calls 5

nextMethod · 0.80
capturedMethod · 0.80
sizeMethod · 0.45
containsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected