MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / trigram_structural_weight

Function trigram_structural_weight

src/simhash/minhash.c:126–138  ·  view source on GitHub ↗

Compute structural weight of a trigram: count of non-normalised tokens (0-3). * Weight 0 = pure data manipulation (noise), weight 3 = rich control flow (signal). */

Source from the content-addressed store, hash-verified

124/* Compute structural weight of a trigram: count of non-normalised tokens (0-3).
125 * Weight 0 = pure data manipulation (noise), weight 3 = rich control flow (signal). */
126static int trigram_structural_weight(const char *a, const char *b, const char *c) {
127 int w = 0;
128 if (!is_normalised_token(a)) {
129 w++;
130 }
131 if (!is_normalised_token(b)) {
132 w++;
133 }
134 if (!is_normalised_token(c)) {
135 w++;
136 }
137 return w;
138}
139
140/* Phase 1: Walk AST iteratively and collect normalised LEAF token types.
141 * Leaf-only counting is language-agnostic: leaf nodes correspond to actual

Callers 1

hash_trigramsFunction · 0.85

Calls 1

is_normalised_tokenFunction · 0.85

Tested by

no test coverage detected