1mod textdist;
8
9pub mod config;
10pub mod vocabulary;
11
12pub use config::{
13 About, ConfigIssue, ConfigIssueKind, FIELD_TYPES, FieldSpec, Fixity, History, IdStorage,
14 OpenClosed, ROOT_CONFIG_KEY, RelationDef, RelationStyleConfig, SPEC_VERSION, WorkspaceConfig,
15 diagnose, field_type_as_config_str, field_type_from_config_str, is_valid_workspace_id,
16 metadata_format_from_str, metadata_format_str, spec_ahead,
17};
18pub use vocabulary::{Term, Vocabulary};
19
20pub fn nearest_vocabulary_term(key: &str, candidates: &[String]) -> Option<String> {
24 textdist::nearest_owned(key, candidates)
25}
26
27pub fn vocabulary_terms_near(a: &str, b: &str) -> bool {
29 (1..=2).contains(&textdist::levenshtein(a, b))
30}
31
32pub fn vocabulary_distance(a: &str, b: &str) -> Option<usize> {
35 let distance = textdist::levenshtein(a, b);
36 (1..=2).contains(&distance).then_some(distance)
37}