MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / candidateLabelsForNode

Function candidateLabelsForNode

deployments/desktop/static/desktop.js:3347–3364  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

3345 }
3346
3347 function candidateLabelsForNode(node) {
3348 const text = nodeSearchText(node);
3349 const labels = new Set(aliasLabelsForText(text));
3350 const tokens = tokenizeKnowledgeText([node?.keywords, rawGraphTitle(node)].filter(Boolean).join(" "));
3351 for (let index = 0; index < tokens.length; index += 1) {
3352 const one = tokens[index];
3353 const two = [tokens[index], tokens[index + 1]].filter(Boolean).join(" ");
3354 const three = [tokens[index], tokens[index + 1], tokens[index + 2]].filter(Boolean).join(" ");
3355 if (one && ["agent", "reasoning", "retrieval", "multimodal", "embedding", "routing"].includes(one)) {
3356 labels.add(titleCaseLabel(one));
3357 }
3358 if (two && two.length <= 34) labels.add(titleCaseLabel(two));
3359 if (three && three.length <= 42 && index % 2 === 0) labels.add(titleCaseLabel(three));
3360 }
3361 return Array.from(labels)
3362 .filter((label) => label && label.length >= 3 && !/^(Q\d|TLDR)$/i.test(label))
3363 .slice(0, 8);
3364 }
3365
3366 function conceptEntriesFromGraph(sourceNodes, sourceEdges) {
3367 const degree = graphDegreeMap(sourceNodes, sourceEdges);

Callers 1

conceptEntriesFromGraphFunction · 0.85

Calls 5

nodeSearchTextFunction · 0.85
aliasLabelsForTextFunction · 0.85
tokenizeKnowledgeTextFunction · 0.85
rawGraphTitleFunction · 0.85
titleCaseLabelFunction · 0.85

Tested by

no test coverage detected