pub struct NgramStats {
pub trigrams: HashMap<(String, String, String), (u32, u32)>,
pub quadgrams: HashMap<(String, String, String, String), (u32, u32)>,
}Expand description
N-gram 統計(3-gram, 4-gram パターン学習)
Fields§
§trigrams: HashMap<(String, String, String), (u32, u32)>3-gram: (a1, a2, a3) → (success_count, failure_count)
quadgrams: HashMap<(String, String, String, String), (u32, u32)>4-gram: (a1, a2, a3, a4) → (success_count, failure_count)
Implementations§
Source§impl NgramStats
impl NgramStats
Sourcepub fn quadgram_success_rate(
&self,
a1: &str,
a2: &str,
a3: &str,
a4: &str,
) -> f64
pub fn quadgram_success_rate( &self, a1: &str, a2: &str, a3: &str, a4: &str, ) -> f64
4-gram の成功率を計算
Sourcepub fn recommended_after(&self, a1: &str, a2: &str) -> Vec<(String, f64)>
pub fn recommended_after(&self, a1: &str, a2: &str) -> Vec<(String, f64)>
2つのアクション列の後に推奨されるアクション一覧
Sourcepub fn recommended_after_three(
&self,
a1: &str,
a2: &str,
a3: &str,
) -> Vec<(String, f64)>
pub fn recommended_after_three( &self, a1: &str, a2: &str, a3: &str, ) -> Vec<(String, f64)>
3つのアクション列の後に推奨されるアクション一覧
pub fn trigram_count(&self) -> usize
pub fn quadgram_count(&self) -> usize
Trait Implementations§
Source§impl Clone for NgramStats
impl Clone for NgramStats
Source§fn clone(&self) -> NgramStats
fn clone(&self) -> NgramStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NgramStats
impl Debug for NgramStats
Source§impl Default for NgramStats
impl Default for NgramStats
Source§fn default() -> NgramStats
fn default() -> NgramStats
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for NgramStats
impl<'de> Deserialize<'de> for NgramStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NgramStats
impl RefUnwindSafe for NgramStats
impl Send for NgramStats
impl Sync for NgramStats
impl Unpin for NgramStats
impl UnwindSafe for NgramStats
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> 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 more