pub enum CountMethod {
WhitespaceSplit,
UnicodeWords,
CjkHybrid,
}Expand description
How words are delimited. Characters are always counted the same way (Unicode scalar
values), independent of this choice — see WordCharCounts.
Variants§
WhitespaceSplit
str::split_whitespace — fast, parity mode (e.g. matching another tool’s count).
Miscounts scripts that are not space-delimited (CJK) and is crude around
punctuation, but it is exactly what many word processors report.
UnicodeWords
UAX #29 word segmentation via unicode_words — the sound general-purpose default:
apostrophes glue ("Elena's" is one word), hyphens split, punctuation-only runs
are excluded. Still undercounts CJK (a run of ideographs may segment as one word).
CjkHybrid
UAX #29 for alphabetic scripts, but every Han / Hiragana / Katakana character counts
as one word — the East-Asian convention, where a “word count” of non-space-delimited
prose approximates a character count. Applied per character (not per detected script
run) so it is correct whether the segmenter split a run per-character (Han) or glued
it (Katakana, UAX #29 rule WB13). Korean (Hangul) is space-delimited and stays on the
UnicodeWords rule.
Trait Implementations§
Source§impl Clone for CountMethod
impl Clone for CountMethod
Source§fn clone(&self) -> CountMethod
fn clone(&self) -> CountMethod
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CountMethod
Source§impl Debug for CountMethod
impl Debug for CountMethod
Source§impl Default for CountMethod
impl Default for CountMethod
Source§fn default() -> CountMethod
fn default() -> CountMethod
Source§impl<'de> Deserialize<'de> for CountMethod
impl<'de> Deserialize<'de> for CountMethod
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CountMethod, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CountMethod, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for CountMethod
Source§impl Hash for CountMethod
impl Hash for CountMethod
Source§impl PartialEq for CountMethod
impl PartialEq for CountMethod
Source§impl Serialize for CountMethod
impl Serialize for CountMethod
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for CountMethod
Auto Trait Implementations§
impl Freeze for CountMethod
impl RefUnwindSafe for CountMethod
impl Send for CountMethod
impl Sync for CountMethod
impl Unpin for CountMethod
impl UnsafeUnpin for CountMethod
impl UnwindSafe for CountMethod
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.