pub struct DocLengths { /* private fields */ }Expand description
Document length table for BM25 normalization. Stores the token count for each node’s content indexed by node ID (dense array).
Implementations§
Source§impl DocLengths
impl DocLengths
Sourcepub fn build(graph: &MemoryGraph, tokenizer: &Tokenizer) -> Self
pub fn build(graph: &MemoryGraph, tokenizer: &Tokenizer) -> Self
Build from graph — tokenize all content and count tokens.
Sourcepub fn add_node(&mut self, event: &CognitiveEvent)
pub fn add_node(&mut self, event: &CognitiveEvent)
Add a single node’s document length.
Sourcepub fn remove_node(&mut self, id: u64)
pub fn remove_node(&mut self, id: u64)
Remove a node’s document length.
Sourcepub fn rebuild(&mut self, graph: &MemoryGraph)
pub fn rebuild(&mut self, graph: &MemoryGraph)
Rebuild from a graph.
Sourcepub fn from_bytes(data: &[u8]) -> Option<Self>
pub fn from_bytes(data: &[u8]) -> Option<Self>
Deserialize from bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DocLengths
impl RefUnwindSafe for DocLengths
impl Send for DocLengths
impl Sync for DocLengths
impl Unpin for DocLengths
impl UnsafeUnpin for DocLengths
impl UnwindSafe for DocLengths
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