pub struct Trigram { /* private fields */ }Available on crate feature
language-detection only.Expand description
How often each letter follows each pair of letters in a text: music21’s
Trigram.
Implementations§
Source§impl Trigram
impl Trigram
Sourcepub fn from_text(text: &str) -> Self
pub fn from_text(text: &str) -> Self
The trigrams of a text, letter by letter, starting after two spaces.
Sourcepub fn from_words<'a>(words: impl IntoIterator<Item = &'a str>) -> Self
pub fn from_words<'a>(words: impl IntoIterator<Item = &'a str>) -> Self
The trigrams of a list of words, each stripped and followed by a space: how music21 reads its excerpts.
Sourcepub fn length(&self) -> FloatType
pub fn length(&self) -> FloatType
The square root of the sum of every count squared: music21’s
length.
Sourcepub fn similarity(&self, other: &Trigram) -> FloatType
pub fn similarity(&self, other: &Trigram) -> FloatType
How alike two texts’ trigrams are, from nought to one: the cosine of
their counts, music21’s similarity.
Sourcepub fn distance(&self, other: &Trigram) -> FloatType
pub fn distance(&self, other: &Trigram) -> FloatType
One less Self::similarity: music21’s -.
Trait Implementations§
impl StructuralPartialEq for Trigram
Auto Trait Implementations§
impl Freeze for Trigram
impl RefUnwindSafe for Trigram
impl Send for Trigram
impl Sync for Trigram
impl Unpin for Trigram
impl UnsafeUnpin for Trigram
impl UnwindSafe for Trigram
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