| 266 | } |
| 267 | |
| 268 | bool cbm_minhash_compute(TSNode func_body, const char *source, int language, cbm_minhash_t *out) { |
| 269 | (void)source; |
| 270 | (void)language; |
| 271 | |
| 272 | if (ts_node_is_null(func_body)) { |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | const char *tokens[MAX_TOKENS]; |
| 277 | int token_count = collect_ast_tokens(func_body, tokens, MAX_TOKENS); |
| 278 | if (token_count < CBM_MINHASH_MIN_NODES) { |
| 279 | return false; |
| 280 | } |
| 281 | |
| 282 | int unique_structural = hash_trigrams(tokens, token_count, out); |
| 283 | return unique_structural >= MIN_UNIQUE_TRIGRAMS; |
| 284 | } |
| 285 | |
| 286 | /* ── Jaccard similarity ──────────────────────────────────────────── */ |
| 287 |
no test coverage detected