MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / normalize_model_card_stem

Function normalize_model_card_stem

server/src/server/model_card.cpp:35–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34// ── Helpers ─────────────────────────────────────────────────────────────
35
36std::string normalize_model_card_stem(const std::string & general_name) {
37 std::string out;
38 out.reserve(general_name.size());
39 for (char c : general_name) {
40 const unsigned char uc = static_cast<unsigned char>(c);
41 if (uc == ' ' || uc == '\t' || uc == '_') {
42 out.push_back('-');
43 } else if (uc >= 'A' && uc <= 'Z') {
44 out.push_back(static_cast<char>(uc - 'A' + 'a'));
45 } else if ((uc >= 'a' && uc <= 'z') ||
46 (uc >= '0' && uc <= '9') ||
47 uc == '.' || uc == '-') {
48 out.push_back(static_cast<char>(uc));
49 }
50 // else: silently drop punctuation
51 }
52 return out;
53}
54
55static bool file_exists(const std::string & path) {

Callers 1

resolve_model_cardFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected