pub struct SemanticCompressor { /* private fields */ }Expand description
Rule-based semantic compressor — no ML required.
Implementations§
Source§impl SemanticCompressor
impl SemanticCompressor
Sourcepub fn new(config: CompressionConfig) -> Self
pub fn new(config: CompressionConfig) -> Self
Create a new compressor with the given configuration.
Sourcepub fn compress(&self, text: &str) -> CompressedMemory
pub fn compress(&self, text: &str) -> CompressedMemory
Compress a single text string.
If the text is shorter than config.min_content_length, returns the
text verbatim with a ratio of 1.0.
Sourcepub fn decompress(&self, compressed: &CompressedMemory) -> String
pub fn decompress(&self, compressed: &CompressedMemory) -> String
Reconstruct an approximate text from a CompressedMemory.
Expands key_facts by appending a parenthetical list of related
entities. If there are no key facts falls back to structured_content.
Sourcepub fn compress_batch(&self, texts: &[&str]) -> Vec<CompressedMemory>
pub fn compress_batch(&self, texts: &[&str]) -> Vec<CompressedMemory>
Compress a batch of texts.
Auto Trait Implementations§
impl Freeze for SemanticCompressor
impl RefUnwindSafe for SemanticCompressor
impl Send for SemanticCompressor
impl Sync for SemanticCompressor
impl Unpin for SemanticCompressor
impl UnsafeUnpin for SemanticCompressor
impl UnwindSafe for SemanticCompressor
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
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.