Skip to main content

NineKeyShuangpin

Struct NineKeyShuangpin 

Source
pub struct NineKeyShuangpin { /* private fields */ }
Expand description

一张两键双拼表,进程里按内容只留一份,以 &'static 交给九宫格;九键用户表使用数字,14 键表从已解析的字母方案派生。

Implementations§

Source§

impl NineKeyShuangpin

Source

pub fn syllable_code(&self, syllable: &str) -> Option<&[u8; 2]>

完整音节的两位编码;不是能打的音节时为 None。

Source

pub fn initial_key(&self, initial: &str) -> Option<u8>

声母所在的键。

Source

pub fn initial_part<'a>(&self, syllable: &'a str) -> &'a str

只打了声母那一位时读音行显示的部分:声母(zh、b),零声母音节是首字母。

Source

pub fn letters(&self, digit: u8) -> &str

组码键上能起头一个音节的字母,见 letters 字段;不是组码或这个键上没有时为空。

Source

pub fn uses_key(&self, digit: u8) -> bool

这张表用到了这个组码键:有声母、韵母或零声母编码放在它上面。

Source

pub fn encode(&self, pinyin: &str) -> String

' 分开的拼写的数字码:完整音节两位,单独的声母一位;有一段两样都不是时整个返回空串。

Source

pub fn spells_keyword(&self, keyword: &str, digits: &str) -> bool

关键词(日期时间的 riqi、sj 这类小写字母)正好拼出 digits:能切成完整音节时按音节的编码比,否则每个字母当一个音节的首字母按声母的键比(简拼)。首字母 z c s 也可以是 zh ch sh(sj 是 shi’jian),与简拼按首字母查词相同。

Source

pub fn spells_initials(&self, canonical_pinyin: &str, digits: &str) -> bool

简拼行(一位数字一个音节)的每个音节都以对应那一位上的声母开头。九宫格的简拼按首字母查词库,z 同时查出 z 和 zh 开头的词,而九键双拼里它们常在不同的键上。

Source

pub fn key_hints(&self) -> Vec<NineKeyShuangpinKeyHint>

键面提示:按电话键盘的 1 到 9、0 列出每个用到的键上的声母和韵母,以及零声母编码是否从这个键开始。声母按电话键盘的习惯排:单字母声母按字母序在前,ch sh zh 在后(3 键是 d f ch);韵母按韵母表的顺序。ü 开头的韵母写成 ü,与 26 键的提示相同。

Trait Implementations§

Source§

impl Debug for NineKeyShuangpin

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.