pub struct Index<IdType>{
pub index: HashMap<IdType, (DefaultSparseVec<u16>, u64)>,
pub avg_tokens_len: u64,
pub max_tokens_len: u64,
pub idf: Map<Vec<u8>>,
pub total_doc_count: u64,
}Fields§
§index: HashMap<IdType, (DefaultSparseVec<u16>, u64)>§avg_tokens_len: u64§max_tokens_len: u64§idf: Map<Vec<u8>>§total_doc_count: u64Implementations§
Source§impl<IdType> Index<IdType>
impl<IdType> Index<IdType>
pub fn new_with_set( index: HashMap<IdType, (DefaultSparseVec<u16>, u64)>, idf: Map<Vec<u8>>, avg_tokens_len: u64, max_tokens_len: u64, total_doc_count: u64, ) -> Self
pub fn get_index(&self) -> &HashMap<IdType, (DefaultSparseVec<u16>, u64)>
Sourcepub fn search_cos_similarity(
&self,
query: &[&str],
n: usize,
) -> Vec<(&IdType, f64)>
pub fn search_cos_similarity( &self, query: &[&str], n: usize, ) -> Vec<(&IdType, f64)>
単純なコサイン類似度検索
Sourcepub fn search_cos_similarity_tuned(
&self,
query: &[&str],
n: usize,
b: f64,
) -> Vec<(&IdType, f64)>
pub fn search_cos_similarity_tuned( &self, query: &[&str], n: usize, b: f64, ) -> Vec<(&IdType, f64)>
文書長を正規化するパラメータを入れたコサイン類似度検索
pub fn search_bm25_tfidf( &self, query: &[&str], n: usize, k1: f64, b: f64, ) -> Vec<(&IdType, f64)>
pub fn synthesize_index(&mut self, other: Self)
pub fn bm25_with_csvec_optimized( query_vec: &DefaultSparseVec<u16>, doc_vec: &DefaultSparseVec<u16>, doc_len: u64, avg_doc_len: f64, k1: f64, b: f64, ) -> f64
Trait Implementations§
Auto Trait Implementations§
impl<IdType> Freeze for Index<IdType>
impl<IdType> RefUnwindSafe for Index<IdType>where
IdType: RefUnwindSafe,
impl<IdType> Send for Index<IdType>where
IdType: Send,
impl<IdType> Sync for Index<IdType>where
IdType: Sync,
impl<IdType> Unpin for Index<IdType>where
IdType: Unpin,
impl<IdType> UnwindSafe for Index<IdType>where
IdType: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more