| 247 | } |
| 248 | |
| 249 | bool cbm_minhash_compute(TSNode func_body, const char *source, int language, cbm_minhash_t *out) { |
| 250 | (void)source; |
| 251 | (void)language; |
| 252 | |
| 253 | if (ts_node_is_null(func_body)) { |
| 254 | return false; |
| 255 | } |
| 256 | |
| 257 | const char *tokens[MAX_TOKENS]; |
| 258 | int token_count = collect_ast_tokens(func_body, tokens, MAX_TOKENS); |
| 259 | if (token_count < CBM_MINHASH_MIN_NODES) { |
| 260 | return false; |
| 261 | } |
| 262 | |
| 263 | int unique_structural = hash_trigrams(tokens, token_count, out); |
| 264 | return unique_structural >= MIN_UNIQUE_TRIGRAMS; |
| 265 | } |
| 266 | |
| 267 | /* ── Jaccard similarity ──────────────────────────────────────────── */ |
| 268 |
no test coverage detected