pub struct MinHashLsh { /* private fields */ }Expand description
MinHash + LSH index for near-duplicate detection.
Supports insert to add documents and query to find candidates
that are likely near-duplicates of a given text.
Implementations§
Source§impl MinHashLsh
impl MinHashLsh
Sourcepub fn insert(&mut self, doc_id: u64, text: &str)
pub fn insert(&mut self, doc_id: u64, text: &str)
Insert a document into the index.
doc_id is a unique identifier for the document.
text is the document content to be shingled and hashed.
Sourcepub fn query(&self, text: &str) -> Vec<u64>
pub fn query(&self, text: &str) -> Vec<u64>
Query the index for candidate near-duplicates of text.
Returns a list of document IDs that share at least one LSH band bucket with the query. These are candidates — false positives are possible but false negatives are unlikely for high-similarity pairs.
Sourcepub fn compute_signature(text: &str) -> MinHashSignature
pub fn compute_signature(text: &str) -> MinHashSignature
Compute the MinHash signature for a text string.
Sourcepub fn get_signature(&self, doc_id: u64) -> Option<&MinHashSignature>
pub fn get_signature(&self, doc_id: u64) -> Option<&MinHashSignature>
Get the stored signature for a document, if it exists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MinHashLsh
impl RefUnwindSafe for MinHashLsh
impl Send for MinHashLsh
impl Sync for MinHashLsh
impl Unpin for MinHashLsh
impl UnsafeUnpin for MinHashLsh
impl UnwindSafe for MinHashLsh
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