pub struct TextEngine { /* private fields */ }Expand description
Loaded text-projection models (SPO tagger + optional English SPLADE + optional gazetteer), reusable across files.
Implementations§
Source§impl TextEngine
impl TextEngine
pub fn load( ml_bundle: &Path, splade_dir: Option<&Path>, ) -> Result<TextEngine, Box<dyn Error + Send + Sync>>
Sourcepub fn enable_growth(&mut self, path: impl Into<PathBuf>)
pub fn enable_growth(&mut self, path: impl Into<PathBuf>)
Enable the growing gazetteer: merge any prior overlay at path, then learn newly-discovered
multi-word entities during ingest and persist them back with Self::save_overlay.
Sourcepub fn save_overlay(&self) -> usize
pub fn save_overlay(&self) -> usize
Persist the learned overlay (no-op unless growth was enabled). Returns the learned-entry count.
Sourcepub fn enable_tuned(
&mut self,
dir: &Path,
base_dir: &Path,
tokenizer: &Path,
max_len: usize,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn enable_tuned( &mut self, dir: &Path, base_dir: &Path, tokenizer: &Path, max_len: usize, ) -> Result<(), Box<dyn Error + Send + Sync>>
Attach a tuned tagger (a save() directory from step 2) so ingest emits typed facets + polarity.
base_dir is the encoder’s HF snapshot (config.json) and tokenizer its tokenizer.json.
Sourcepub fn enable_relations(
&mut self,
dir: &Path,
spec: &VocabularySpace,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn enable_relations( &mut self, dir: &Path, spec: &VocabularySpace, ) -> Result<(), Box<dyn Error + Send + Sync>>
Attach Head C (step 5) to the tuned tagger so ingest emits bound relation tokens.
Sourcepub fn project_situation(&mut self, sentence: &str) -> Situation
pub fn project_situation(&mut self, sentence: &str) -> Situation
Project one sentence into a full Situation — tokens, numeric fields, and infon polarity.
This is the ingest entry point that preserves everything the tuned tagger knows; project_sentence
remains for callers that only need tokens.
Sourcepub fn project_sentence(
&mut self,
sentence: &str,
) -> (Vec<String>, Vec<(String, f64)>)
pub fn project_sentence( &mut self, sentence: &str, ) -> (Vec<String>, Vec<(String, f64)>)
Project one sentence → (sorted de-duplicated tokens, numeric quantity fields). QTY spans that
canonicalise (via units) become (field, si_value) pairs for (num …) range queries.
Sourcepub fn tokens_for(&mut self, sentence: &str) -> Vec<String>
pub fn tokens_for(&mut self, sentence: &str) -> Vec<String>
Project one sentence to a sorted, de-duplicated token set (tokens only).
Sourcepub fn project_text(&mut self, text: &str, sink: &mut dyn FnMut(Situation))
pub fn project_text(&mut self, text: &str, sink: &mut dyn FnMut(Situation))
Drive a sink with one Situation per sentence of text.
Auto Trait Implementations§
impl !Freeze for TextEngine
impl !RefUnwindSafe for TextEngine
impl !UnwindSafe for TextEngine
impl Send for TextEngine
impl Sync for TextEngine
impl Unpin for TextEngine
impl UnsafeUnpin for TextEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more