Skip to main content

Candidate

Struct Candidate 

Source
pub struct Candidate {
    pub word: String,
    pub kind: KanaKind,
    pub freq: u32,
    pub composed: bool,
    pub proximity_milli: u16,
}
Expand description

One JP candidate with its sub-source category, so the host UI can optionally render a hint (kana vs kanji) on top of the W/P/J source dot at the composite layer.

Fields§

§word: String§kind: KanaKind§freq: u32

0–100 frequency score. Higher = more common in modern JP. Used by the composite-layer scoring (japanese_adapter::candidates_with_scores) to lift high-frequency JP entries above rare Chinese candidates per the user’s design rule: JP-base < wubi/pinyin bases, but JP-high-freq must beat 中文难检字 + 生僻词组. For kana entries (mechanical romaji → kana rendering) freq is 0.

§composed: bool

true for compose_sentence products — mechanical (content + particle/copula) sentence guesses like 私は or, for non-Japanese romaji, junk like 時へ時. These are LOW confidence: unlike a real dictionary 熟語 (新宿) they must never be treated as jukugo nor trigger the full-match promote, and must score below real Chinese words so they don’t pollute Chinese pinyin input. See japanese_adapter::candidates_with_scores.

§proximity_milli: u16

Prefix-prediction proximity in thousandths: 1000 = the buffer is the full reading (a normal/exact candidate); < 1000 = this is a PREDICTED candidate whose reading the buffer is only a prefix of (shinjuk → 新宿 at 7/8 = 875). japanese_adapter decays the freq contribution by (proximity/1000)^K and excludes < 1000 from the full-match promote (the buffer isn’t the complete word yet). See PLAN-prefix-prediction.md.

Trait Implementations§

Source§

impl Clone for Candidate

Source§

fn clone(&self) -> Candidate

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 Candidate

Source§

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

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

impl PartialEq for Candidate

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Candidate

Source§

impl StructuralPartialEq for Candidate

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.