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

Method jaccard

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

Source from the content-addressed store, hash-verified

655 }
656
657 fn jaccard(a: &HashSet<(u8, u8)>, b: &HashSet<(u8, u8)>) -> f64 {
658 if a.is_empty() && b.is_empty() {
659 return 0.0;
660 }
661 let inter = a.intersection(b).count();
662 let union = a.union(b).count();
663 if union == 0 {
664 0.0
665 } else {
666 inter as f64 / union as f64
667 }
668 }
669
670 // 1. Collect all Removed and Added lines with their original indices
671 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