Skip to main content

CompiledAnalyzer

Struct CompiledAnalyzer 

Source
pub struct CompiledAnalyzer { /* private fields */ }
Expand description

A frozen pipeline with compiled expressions, fixed stop sets, and resolved synonym maps.

Implementations§

Source§

impl CompiledAnalyzer

Source

pub fn descriptor(&self) -> &Arc<AnalyzerDescriptor>

Source

pub fn analyze_tokens(&self, text: &str) -> AnalysisResult<AnalyzedText>

Analyze with independent output/source state and no expression compilation or file resolution.

Source

pub fn analyze_tokens_budgeted( &self, text: &str, budget: &MemoryBudget, poll: impl FnMut() -> AnalysisResult<()>, ) -> AnalysisResult<Budgeted<AnalyzedText>>

Execute all prepared stages with one allowance for runtime buffers and retained output.

Immutable compiled resources and borrowed input have separate owners. Character maps, tokenization, common/Korean filters and source projections share this allowance. Errors return no partial output. Prepared regex automata retain analysis-owned search workspaces and poll during traversal and capture resolution.

use uqa_analysis::standard_analyzer;
use uqa_core::memory::MemoryBudget;
let compiled = standard_analyzer("english").compile()?;
let budget = MemoryBudget::new(64 * 1024);
let result = compiled.analyze_tokens_budgeted("The cats and", &budget, || Ok(()))?;
assert_eq!(result.tokens()[0].term(), "cat");
assert_eq!(result.final_position_increment(), 1);
drop(result);
assert_eq!(budget.used(), 0);
Source

pub fn analyze(&self, text: &str) -> AnalysisResult<Vec<String>>

Source

pub fn normalize(&self, text: &str) -> AnalysisResult<String>

Normalize complete input with its retained plan, independently of analysis stages.

Source

pub fn normalize_budgeted( &self, text: &str, budget: &MemoryBudget, poll: impl FnMut() -> AnalysisResult<()>, ) -> AnalysisResult<Budgeted<String>>

Normalize complete text with one retained output allowance and cancellation callback.

Source§

impl CompiledAnalyzer

Source

pub fn analyze_diagnostic_budgeted( &self, text: &str, budget: &MemoryBudget, poll: impl FnMut() -> AnalysisResult<()>, ) -> AnalysisResult<Budgeted<String>>

Analyze and encode the complete token graph, source end state, and immutable revision.

Analysis and JSON output share the supplied allowance. The token stream remains reserved until encoding finishes, and cancellation is checked while writing. The returned string retains its output reservation.

Trait Implementations§

Source§

impl Debug for CompiledAnalyzer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.