Skip to main content

ling/lexicon/
mod.rs

1// src/lexicon/mod.rs
2pub fn canonical_token(token: &str) -> String {
3    token.to_string()
4}
5
6// Lexicon system is WIP; keep stubs for public API.
7#[derive(Clone, Debug)]
8pub struct Lexicon;
9
10#[derive(Clone, Debug, Default)]
11pub struct LexiconRegistry;
12
13impl LexiconRegistry {
14    pub fn global() -> &'static Self {
15        static REG: once_cell_stub::OnceCell<LexiconRegistry> = once_cell_stub::OnceCell::new();
16        REG.get_or_init(|| LexiconRegistry)
17    }
18
19    pub fn translate(&self, text: &str, _from: &str, _to: &str) -> String {
20        text.to_string()
21    }
22}
23
24// Minimal once_cell substitute to avoid adding deps.
25mod once_cell_stub {
26    use std::sync::OnceLock;
27    pub struct OnceCell<T>(OnceLock<T>);
28    impl<T> OnceCell<T> {
29        pub const fn new() -> Self {
30            Self(OnceLock::new())
31        }
32
33        pub fn get_or_init(&'static self, f: impl FnOnce() -> T) -> &'static T {
34            self.0.get_or_init(f)
35        }
36    }
37}
38
39#[derive(Clone, Debug)]
40pub struct CanonicalToken(pub String);