pub fn jaccard_weighted(
reference: &ElementFingerprint,
candidate: &ElementFingerprint,
) -> f32Expand description
Compute the weighted Jaccard similarity between two element fingerprints.
Weights:
| Component | Weight |
|---|---|
| Tag name match | 0.40 |
| Class list Jaccard | 0.35 |
| Attribute name Jaccard | 0.15 |
| Depth proximity | 0.10 |
Returns a score in [0.0, 1.0].
ยงExample
use stygian_browser::similarity::{ElementFingerprint, jaccard_weighted};
let a = ElementFingerprint { tag: "div".into(), classes: vec!["foo".into()], attr_names: vec![], depth: 2 };
let b = a.clone();
assert!((jaccard_weighted(&a, &b) - 1.0).abs() < 1e-6);