Skip to main content

xml_3dm/
constants.rs

1//! Constants used throughout 3DM.
2//!
3//! These constants mirror those in the Java Measure class.
4
5/// Maximum distance value. Distance is normalized between 0 and MAX_DIST.
6pub const MAX_DIST: f64 = 1.0;
7
8/// Distance to return by child_list_distance if both nodes have 0 children.
9pub const ZERO_CHILDREN_MATCH: f64 = 1.0;
10
11/// Info bytes in an element name ($c_e$ in thesis).
12pub const ELEMENT_NAME_INFO: i32 = 1;
13
14/// Info bytes in the presence of an attribute ($c_a$ in thesis).
15pub const ATTR_INFO: i32 = 2;
16
17/// Attribute values less than this have an info size of 1 ($c_v$ in thesis).
18pub const ATTR_VALUE_THRESHOLD: i32 = 5;
19
20/// Text nodes shorter than this have an info size of 1 ($c_t$ in thesis).
21pub const TEXT_THRESHOLD: i32 = 5;
22
23/// Penalty term ($c_p$ in thesis).
24pub const PENALTY_C: i32 = 20;
25
26/// Minimum info bytes for copy detection (from HeuristicMatching).
27pub const COPY_THRESHOLD: i32 = 128;
28
29/// Max distance for fuzzy DFS matching.
30pub const DFS_MATCH_THRESHOLD: f64 = 0.2;
31
32/// Max distance for candidate fuzzy matching.
33pub const MAX_FUZZY_MATCH: f64 = 0.2;
34
35/// Info bytes per tree edge.
36pub const EDGE_BYTES: i32 = 4;