Module equivalence

Module equivalence 

Source
Expand description

Semantic equivalence mapping system.

This module provides equivalence mapping to recognize synonyms and related terms as semantically equivalent. Mappings are field-specific, allowing different equivalence rules for different fields.

§Examples

use lnmp_codec::EquivalenceMapper;

let mut mapper = EquivalenceMapper::new();

// Add mapping for field 7 (is_active)
mapper.add_mapping(7, "yes".to_string(), "1".to_string());
mapper.add_mapping(7, "true".to_string(), "1".to_string());
mapper.add_mapping(7, "no".to_string(), "0".to_string());
mapper.add_mapping(7, "false".to_string(), "0".to_string());

// Map values to canonical form
assert_eq!(mapper.map(7, "yes"), Some("1".to_string()));
assert_eq!(mapper.map(7, "true"), Some("1".to_string()));
assert_eq!(mapper.map(7, "no"), Some("0".to_string()));
assert_eq!(mapper.map(7, "unmapped"), None);

Structs§

EquivalenceMapper
Equivalence mapper for semantic synonym mapping