pub struct TextAligner { /* private fields */ }
Expand description
Text aligner for mapping extractions to source text positions
Implementations§
Source§impl TextAligner
impl TextAligner
Sourcepub fn with_config(config: AlignmentConfig) -> Self
pub fn with_config(config: AlignmentConfig) -> Self
Create a new text aligner with custom configuration
Sourcepub fn align_extractions(
&self,
extractions: &mut [Extraction],
source_text: &str,
char_offset: usize,
) -> LangExtractResult<usize>
pub fn align_extractions( &self, extractions: &mut [Extraction], source_text: &str, char_offset: usize, ) -> LangExtractResult<usize>
Align extractions with the source text
Sourcepub fn align_single_extraction(
&self,
extraction: &mut Extraction,
source_text: &str,
char_offset: usize,
) -> LangExtractResult<Option<CharInterval>>
pub fn align_single_extraction( &self, extraction: &mut Extraction, source_text: &str, char_offset: usize, ) -> LangExtractResult<Option<CharInterval>>
Align a single extraction with the source text
Sourcepub fn align_chunk_extractions(
&self,
extractions: &mut [Extraction],
chunk_text: &str,
chunk_char_offset: usize,
) -> LangExtractResult<usize>
pub fn align_chunk_extractions( &self, extractions: &mut [Extraction], chunk_text: &str, chunk_char_offset: usize, ) -> LangExtractResult<usize>
Align extractions for chunked text processing
Sourcepub fn get_alignment_stats(&self, extractions: &[Extraction]) -> AlignmentStats
pub fn get_alignment_stats(&self, extractions: &[Extraction]) -> AlignmentStats
Get alignment statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextAligner
impl RefUnwindSafe for TextAligner
impl Send for TextAligner
impl Sync for TextAligner
impl Unpin for TextAligner
impl UnwindSafe for TextAligner
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