Skip to main content

SessionOptions

Struct SessionOptions 

Source
pub struct SessionOptions {
Show 52 fields pub paths: RuntimePaths, pub scheme: SchemeType, pub enabled_schemes: SchemeSet, pub shuangpin_profile: ShuangpinProfileKind, pub shuangpin_custom_profile: Option<ShuangpinCustomTable>, pub shuangpin_preedit_uses_raw: bool, pub vietnamese_input_method: InputMethod, pub vietnamese_tone_style: ToneStyle, pub korean_layout: KoreanLayout, pub cantonese_dictionary: PathBuf, pub force_cantonese_shuangpin: bool, pub zhuyin_dictionary: PathBuf, pub stroke_dictionary: PathBuf, pub japanese_dictionary: PathBuf, pub helpcode_schema: String, pub helpcode_trigger_key: Option<u8>, pub helpcode_table: Option<SharedKeymap>, pub helpcode_fallback_resources: Option<PathBuf>, pub autocorrect_types: u32, pub helpcode: bool, pub strict_quanpin_helpcode: bool, pub shuangpin_helpcode_modes: ShuangpinHelpcodeModes, pub chinese_punctuation: bool, pub paired_punctuation: bool, pub punctuation_lock: i32, pub punctuation_marks: PunctuationMarks, pub learning: bool, pub learn_english_on_enter: bool, pub sentence_alternatives: bool, pub first_page_rows: usize, pub single_character_only: bool, pub caret_edit_suffix: bool, pub fuzzy_pinyin: FuzzyPinyinOptions, pub frequency: FrequencyAdjustmentOptions, pub local_modes: LocalModeOptions, pub mixed_candidates: bool, pub english: EnglishInputOptions, pub expressive: MixedExpressiveOptions, pub japanese_mixing: bool, pub multilingual_languages: Vec<Language>, pub wubi: WubiInputOptions, pub personal_context: bool, pub next_word_prediction: bool, pub sentence_association: SentenceAssociationOptions, pub rescoring_context: String, pub command_table: Vec<CommandTableEntry>, pub plugin_commands: Vec<PluginCommand>, pub mention_entries: Vec<MentionEntry>, pub quick_phrase_table: Vec<QuickPhraseEntry>, pub quick_phrase_candidates: bool, pub quick_phrase_frequency: bool, pub chaizi_traditional_output: bool,
}
Expand description

Everything a session is built with. learning_undo is gone with the feature.

Fields§

§paths: RuntimePaths§scheme: SchemeType§enabled_schemes: SchemeSet

会话允许运行的方案,缺省全部。scheme 和之后的 switch_scheme 都必须在其中;只为其中的方案构造 provider(见 SchemeSet)。

§shuangpin_profile: ShuangpinProfileKind§shuangpin_custom_profile: Option<ShuangpinCustomTable>

shuangpin_profile 为 Custom 时的键位表。没有它或它不合法时,会话里有双拼就建不起来(INVALID_CUSTOM_SHUANGPIN_PROFILE),没有双拼就按小鹤;内置方案不读它。

§shuangpin_preedit_uses_raw: bool

Shuangpin preedit shows the typed keys rather than the decoded quanpin.

§vietnamese_input_method: InputMethod

How the Vietnamese scheme spells marks: Telex letters or VNI digits.

§vietnamese_tone_style: ToneStyle

Where the Vietnamese scheme puts the tone on oa, oe and uy.

§korean_layout: KoreanLayout

韩语实体键盘布局,缺省两套式。

§cantonese_dictionary: PathBuf

Where msime-cantonese.db is; empty when the host has none. Read only when Cantonese is activated, which fails without it.

§force_cantonese_shuangpin: bool

独立粤语双拼入口强制按两键码解释,普通粤拼入口仍按现有规则自动识别。

§zhuyin_dictionary: PathBuf

Where msime-zhuyin.db is; empty when the host has none. Read only when Zhuyin is activated, which fails without it.

§stroke_dictionary: PathBuf

Where msime-stroke.db is; empty when the host has none. Read only when Stroke is activated, which fails without it.

§japanese_dictionary: PathBuf

msime-japanese.dat 的位置;为空时读资源目录里的那份。文件缺失时日文只给假名行。

§helpcode_schema: String§helpcode_trigger_key: Option<u8>

辅助码前导标点;None 保留现有 Shift 加字母。

§helpcode_table: Option<SharedKeymap>

宿主给的辅助码表;有它时直接装上它,不再按 helpcode_schema 读表(名字仍然要合法)。Session::set_helpcode_table 可以实时替换。

§helpcode_fallback_resources: Option<PathBuf>

内置辅助码表缺失时使用的随包资源根目录。

§autocorrect_types: u32

autocorrect_type bits; 0 keeps the user’s spelling. Either of transposition and neighbor also enables missing and extra letters, and on inputs of three or more complete syllables offers a sentence that reads one syllable as a typo. Committing the raw letters while a correction is offered turns correction off for that exact input.

§helpcode: bool§strict_quanpin_helpcode: bool

一码辅助码严格筛选,默认关闭以保持原有重排行为。

§shuangpin_helpcode_modes: ShuangpinHelpcodeModes

双拼辅助码的触发方式(Windows [helpcode] 组的双拼专属键);只在双拼方案下生效。

§chinese_punctuation: bool§paired_punctuation: bool§punctuation_lock: i32

0 follows the mode, 1 forces Chinese, 2 forces ASCII.

§punctuation_marks: PunctuationMarks

中文标点下引号键和方头括号键出哪一组字,缺省是弯引号、实心括号。

§learning: bool§learn_english_on_enter: bool

回车上屏英文拼写时是否把它学进英文词库(Windows input.enter_learns_english_word,出厂为开)。

§sentence_alternatives: bool

Hand back every whole-sentence reading instead of only the best. A host that sets this must reorder and crop them itself.

§first_page_rows: usize

宿主的每页候选数(candidate_page_size):全长组的精确同音词够这么多行就不再并入更长的补全词。0 到请求里会归一成 1。

§single_character_only: bool

只出单字:中文方案的候选去掉含汉字的词和整句、只留单个汉字(见 SchemeType::filters_to_single_characters),选一个字后剩下的拼写接着组字。

§caret_edit_suffix: bool

移动光标后编辑光标后的部分(默认关):全拼、双拼的组字光标停在中间时,光标前的原文固定为它当前的最佳转换,候选是光标后那段原文的候选,首选前面接上固定的部分;选中一条只消耗它的音节,固定部分和已选部分一起留到组字结束。规则见 session/caret_edit.rs。

§fuzzy_pinyin: FuzzyPinyinOptions§frequency: FrequencyAdjustmentOptions§local_modes: LocalModeOptions§mixed_candidates: bool

候选混输总开关(Windows utility.mixed_candidates):关掉后英文、emoji、颜文字、符号、日文混输行、行内日期时间和快捷短语都不再混进普通候选;各分成员(english.mixed_candidates、expressive.*、local_modes.*)原值保留,重新打开即恢复。本地模式本身(T、K、M 等)不受影响。

§english: EnglishInputOptions§expressive: MixedExpressiveOptions§japanese_mixing: bool

日文混输(实验选项,默认关):全拼、双拼组字时,整段输入像日文罗马字就混进一行日文转换(来源 MixedJapanese),见 ImeSession::mixed_japanese_conversion。需要会话带日文(enabled_schemes 含 JapaneseRomaji)和日文模型;开着时建会话就在后台预热模型。

§multilingual_languages: Vec<Language>

连续多语言输入所选的语言;默认空集合关闭,少于两种不生成混合行。

§wubi: WubiInputOptions§personal_context: bool

Learn word sequences and pick pairs; also needs learning.

§next_word_prediction: bool

上屏后联想;独立于整句候选,默认关闭。

§sentence_association: SentenceAssociationOptions§rescoring_context: String

Committed text the neural sentence models condition on; Session::set_rescoring_context updates it live.

§command_table: Vec<CommandTableEntry>

The / mode’s commands beyond the built-in ones; Session::set_command_table replaces it live.

§plugin_commands: Vec<PluginCommand>

脚本插件在 / 模式里的指令(只在桌面非空);Session::set_plugin_commands 可以实时替换。

§mention_entries: Vec<MentionEntry>

The @ mode’s names and places; Session::set_mention_entries replaces it live.

§quick_phrase_table: Vec<QuickPhraseEntry>

K 模式在数据库行之后追加的宿主短语;Session::set_quick_phrase_table 可以实时替换。

§quick_phrase_candidates: bool

普通候选是否追加编码匹配的快捷短语。仅 macOS 桌面宿主打开;其他宿主保留独立 K 模式。

§quick_phrase_frequency: bool

快捷短语参与调频:追加进普通候选的整组短语有自己的槽位(quick_phrase_slots 日志表),越过它选普通候选让整组后退(最多退到首页末位),选中组内短语让整组前移。关掉时组固定在默认位置(首页最后几格,普通候选不满一页时接在它们之后,见 default_quick_phrase_slot),槽位记录保留但不读。

§chaizi_traditional_output: bool

宿主会把候选转成繁体输出:拆字(C)行按转换后的字形去重,免得一屏出现两个相同的繁体字。

Implementations§

Source§

impl SessionOptions

Source

pub fn new(paths: RuntimePaths) -> Self

引擎库唯一的一套默认值,建在给定路径上。大部分沿用参照实现(session.h:12-54):全拼、小鹤、学习开、个人上下文开、中文标点和成对标点开、频率按 FrequencyAdjustmentOptions::default()。与参照实现不同的只有辅助码:默认关,表名默认 wubi86。随仓库的七张辅助码表里只有 wubi86 写明了来源与许可(resources/helpcodes/NOTICE-wubi86.md),参照实现默认的 lantian 和产品默认的 ziranma 都没有再分发授权(resources/helpcodes/NOTICE.md),引擎库默认不读它们;要辅助码的嵌入方自己打开并选表。

产品不靠这套默认值:host 门面(host::options::session_options)逐字段给出产品取值,golden 基准在 tests/golden_support 里按参照实现补回辅助码。

Trait Implementations§

Source§

impl Clone for SessionOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SessionOptions

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SessionOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SessionOptions

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.