pub struct AnalyzedText { /* private fields */ }Expand description
A complete analyzed input with explicit token graph and source end state.
Implementations§
Source§impl AnalyzedText
impl AnalyzedText
Sourcepub fn clone_budgeted(
&self,
budget: &MemoryBudget,
poll: impl FnMut() -> AnalysisResult<()>,
) -> AnalysisResult<Budgeted<Self>>
pub fn clone_budgeted( &self, budget: &MemoryBudget, poll: impl FnMut() -> AnalysisResult<()>, ) -> AnalysisResult<Budgeted<Self>>
Copy owned token buffers into this allowance while sharing retained source allocations with the original.
Every term, morphology value, token buffer and hidden terminal token receives its own reservation. Existing source projection and mapping leases remain shared with the input. Failure leaves the borrowed result unchanged.
use uqa_analysis::Tokenizer;
use uqa_core::memory::MemoryBudget;
let budget = MemoryBudget::new(64 * 1024);
let input = Tokenizer::Whitespace.tokenize_with_offsets_budgeted(
"韓🙂 UQA", &budget, || Ok(()),
)?;
let copied = input.clone_budgeted(&budget, || Ok(()))?;
assert_eq!(*copied, *input);
drop(input);
assert!(budget.used() >= copied.reserved_bytes());
drop(copied);
assert_eq!(budget.used(), 0);Source§impl AnalyzedText
impl AnalyzedText
pub fn tokens(&self) -> &[AnalysisToken]
pub fn into_tokens(self) -> Vec<AnalysisToken>
pub fn into_terms(self) -> AnalysisResult<Vec<String>>
pub fn final_offsets(&self) -> &SourceOffsets
pub fn final_position_increment(&self) -> u32
Trait Implementations§
Source§impl Clone for AnalyzedText
impl Clone for AnalyzedText
Source§fn clone(&self) -> AnalyzedText
fn clone(&self) -> AnalyzedText
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AnalyzedText
impl Debug for AnalyzedText
impl Eq for AnalyzedText
Source§impl PartialEq for AnalyzedText
impl PartialEq for AnalyzedText
Source§impl Serialize for AnalyzedText
impl Serialize for AnalyzedText
impl StructuralPartialEq for AnalyzedText
Auto Trait Implementations§
impl Freeze for AnalyzedText
impl RefUnwindSafe for AnalyzedText
impl Send for AnalyzedText
impl Sync for AnalyzedText
impl Unpin for AnalyzedText
impl UnsafeUnpin for AnalyzedText
impl UnwindSafe for AnalyzedText
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
Mutably borrows from an owned value. Read more