MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / jaccard

Method jaccard

atomic-cli/src/commands/diff/helpers.rs:426–437  ·  view source on GitHub ↗
(a: &HashSet<(u8, u8)>, b: &HashSet<(u8, u8)>)

Source from the content-addressed store, hash-verified

424 }
425
426 fn jaccard(a: &HashSet<(u8, u8)>, b: &HashSet<(u8, u8)>) -> f64 {
427 if a.is_empty() && b.is_empty() {
428 return 0.0;
429 }
430 let inter = a.intersection(b).count();
431 let union = a.union(b).count();
432 if union == 0 {
433 0.0
434 } else {
435 inter as f64 / union as f64
436 }
437 }
438
439 // 1. Collect all Removed and Added lines with their original indices
440 let mut rm_entries: Vec<(usize, &HunkLine)> = Vec::new();

Callers

nothing calls this directly

Calls 2

is_emptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected