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

Function jaccard

atomic-repository/src/diff_engine.rs:1112–1123  ·  view source on GitHub ↗
(a: &HashSet<(u8, u8)>, b: &HashSet<(u8, u8)>)

Source from the content-addressed store, hash-verified

1110 }
1111
1112 fn jaccard(a: &HashSet<(u8, u8)>, b: &HashSet<(u8, u8)>) -> f64 {
1113 if a.is_empty() && b.is_empty() {
1114 return 0.0;
1115 }
1116 let inter = a.intersection(b).count();
1117 let union = a.union(b).count();
1118 if union == 0 {
1119 0.0
1120 } else {
1121 inter as f64 / union as f64
1122 }
1123 }
1124
1125 // 1. Collect all Removed and Added lines with their original indices
1126 let mut rm_entries: Vec<(usize, &HunkLine)> = Vec::new();

Callers 2

repair_diff_linesMethod · 0.85
repair_diff_linesFunction · 0.85

Calls 2

is_emptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected