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). */
| 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). */ |
| 126 | static 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 |
no test coverage detected