Skip to main content

LanguageDictionary

Struct LanguageDictionary 

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

An open language dictionary whose format version has been checked.

Implementations§

Source§

impl LanguageDictionary

Source

pub fn metadata(&self, name: &str) -> Result<Option<String>>

The metadata value stored under name.

Source

pub fn lookup(&self, key: &str, limit: usize) -> Result<Vec<LanguageEntry>>

The entries stored under exactly key, heaviest first and by text within a weight, at most limit.

Source

pub fn lookup_into( &self, key: &str, limit: usize, result: &mut Vec<LanguageEntry>, ) -> Result<()>

将精确键的查询结果写入已有缓冲,保留其中字符串的容量。

Source

pub fn has_syllable(&self, syllable: &str) -> Result<bool>

Whether syllable is in the scheme’s syllable inventory.

Source

pub fn syllables(&self) -> Result<Vec<String>>

The whole syllable inventory, for a scheme that segments typed letters against it in memory.

Source

pub fn lookup_completions( &self, prefix: &str, limit: usize, ) -> Result<Vec<(String, LanguageEntry)>>

The entries whose key completes the last syllable of prefix: the key starts with prefix and has no syllable boundary after it, so nei h finds nei hou but not nei hou aa. Each comes with its key, heaviest first and by text within a weight, at most limit.

Source

pub fn lookup_completions_into( &self, prefix: &str, limit: usize, result: &mut Vec<(String, LanguageEntry)>, ) -> Result<()>

将补全查询结果写入已有缓冲,保留键和值字符串的容量。

Source

pub fn texts_with_key_prefix(&self, prefix: &str) -> Result<Vec<String>>

键以 prefix 开头的全部词条的文字,不分先后、可能重复。九宫格的笔画筛选用它取「笔顺以这几笔开头的字」:键按前缀落在一段连续区间里,只扫这一段。

Source

pub fn lookup_pattern( &self, pattern: &str, wildcard: char, completions: bool, limit: usize, ) -> Result<Vec<(String, LanguageEntry)>>

匹配 pattern 的词条,wildcard 匹配任意非空格字符,其他字符按字面匹配。补全只匹配键前缀且余下部分不能有音节边界;精确匹配整个键。按权重降序、文字升序返回至多 limit 条。首个通配符前的字面前缀限制扫描范围,只有开头通配符需要整表过滤。

Source

pub fn lookup_pattern_into( &self, pattern: &str, wildcard: char, completions: bool, limit: usize, result: &mut Vec<(String, LanguageEntry)>, ) -> Result<()>

将通配查询写入已有缓冲,复用键与文字的字符串容量;空模式清空结果。

Source

pub fn lookup_readings( &self, positions: &[&[String]], limit: usize, ) -> Result<Vec<(String, LanguageEntry)>>

键按位置逐段取自 positions[i](以单个空格连接)的词条,各带自己的键;按权重从重到轻,再按文字、键排序,至多 limit 条。每个位置都只有一个读音时就是 lookup 对连接后的键查询,结果与它逐条相同。

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.