MCPcopy Create free account
hub / github.com/neomjs/neo / extractCodeTerms

Method extractCodeTerms

ai/services/knowledge-base/QueryService.mjs:748–755  ·  view source on GitHub ↗

* @summary Extracts code-ish identifiers such as `mutate_frontier` as compact lexical terms. * @param {String} query Query string. * @returns {String[]} Normalized code terms.

(query)

Source from the content-addressed store, hash-verified

746 * @returns {String[]} Normalized code terms.
747 */
748 extractCodeTerms(query) {
749 const matches = query.match(/[a-zA-Z][a-zA-Z0-9]*(?:[_-][a-zA-Z0-9]+)+/g) || [];
750
751 return [...new Set(matches
752 .filter(match => !query.toLowerCase().includes(`${match.toLowerCase()}.`))
753 .map(match => this.normalizeLexicalValue(match))
754 .filter(term => term.length > 5))];
755 }
756
757 /**
758 * @summary Infers the public KB type for a local source path.

Callers 1

addCodeTermRescuesMethod · 0.95

Calls 3

normalizeLexicalValueMethod · 0.95
includesMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected