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    pub fn translate(&self, text: &str, _from: &str, _to: &str) -> String {
19        text.to_string()
20    }
21}
22
23// Minimal once_cell substitute to avoid adding deps.
24mod once_cell_stub {
25    use std::sync::OnceLock;
26    pub struct OnceCell<T>(OnceLock<T>);
27    impl<T> OnceCell<T> {
28        pub const fn new() -> Self {
29            Self(OnceLock::new())
30        }
31        pub fn get_or_init(&'static self, f: impl FnOnce() -> T) -> &'static T {
32            self.0.get_or_init(f)
33        }
34    }
35}
36
37#[derive(Clone, Debug)]
38pub struct CanonicalToken(pub String);
39