pub struct HierarchicalMapping {
pub name: String,
pub coarse_categories: IndexMap<String, String>,
pub fine_criteria: IndexMap<String, String>,
pub coarse_to_fine: IndexMap<String, Vec<String>>,
pub fine_to_coarse: IndexMap<String, String>,
pub all_coarse_keys: Vec<String>,
pub all_fine_keys: Vec<String>,
pub negative_keys: Vec<String>,
}Expand description
大分類と細分類の対応関係を保持する階層マッピング構造体。
大分類 (4〜8 クラスタ) と細分類 (各 8〜12 候補) の双方向高速参照を実現する。
Fields§
§name: Stringマッピング全体の識別名。
coarse_categories: IndexMap<String, String>大分類の識別子と説明文のマッピング。
fine_criteria: IndexMap<String, String>全細分類の識別子と説明文のマッピング。
coarse_to_fine: IndexMap<String, Vec<String>>大分類識別子から配下の細分類識別子リストへのマッピング。
fine_to_coarse: IndexMap<String, String>細分類識別子から所属する大分類識別子への逆引きマッピング。
all_coarse_keys: Vec<String>事前キャッシュされた全大分類キーの順序保持リスト。
all_fine_keys: Vec<String>事前キャッシュされた全細分類キーの順序保持リスト。
negative_keys: Vec<String>受け皿 (None / その他) 候補として判定するキー一覧。
Implementations§
Source§impl HierarchicalMapping
impl HierarchicalMapping
Sourcepub fn builder(name: impl Into<String>) -> HierarchicalMappingBuilder
pub fn builder(name: impl Into<String>) -> HierarchicalMappingBuilder
新しいビルダーを生成する。
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
マッピングの MECE 性および整合性を検証する。
§検証項目
- 大分類が 1 つ以上定義されていること。
- 各大分類に少なくとも 1 つ以上の細分類が割り当てられていること。
- すべての細分類が
fine_criteriaに定義されていること。 - すべての細分類がいずれか 1 つの大分類にのみ重複なく所属していること。
coarse_to_fineとfine_to_coarseが厳密に双方向一致していること。
Sourcepub fn coarse_criteria(&self) -> &IndexMap<String, String>
pub fn coarse_criteria(&self) -> &IndexMap<String, String>
大分類のキーおよび説明文マップを取得する。
Sourcepub fn fine_keys_for_coarse(&self, coarse_key: &str) -> Option<&[String]>
pub fn fine_keys_for_coarse(&self, coarse_key: &str) -> Option<&[String]>
指定された大分類キー配下の細分類識別子スライスを取得する。
Sourcepub fn coarse_for_fine(&self, fine_key: &str) -> Option<&str>
pub fn coarse_for_fine(&self, fine_key: &str) -> Option<&str>
指定された細分類が属する大分類キーを取得する。
Sourcepub fn total_fine_count(&self) -> usize
pub fn total_fine_count(&self) -> usize
登録されている細分類の総数を取得する。
Sourcepub fn total_coarse_count(&self) -> usize
pub fn total_coarse_count(&self) -> usize
登録されている大分類の総数を取得する。
Sourcepub fn all_fine_keys(&self) -> &[String]
pub fn all_fine_keys(&self) -> &[String]
事前キャッシュされた全細分類キーの参照スライスを取得する。
Sourcepub fn all_coarse_keys(&self) -> &[String]
pub fn all_coarse_keys(&self) -> &[String]
事前キャッシュされた全大分類キーの参照スライスを取得する。
Sourcepub fn is_negative_candidate(&self, key: &str, description: &str) -> bool
pub fn is_negative_candidate(&self, key: &str, description: &str) -> bool
指定された候補が受け皿 (None / その他) 候補であるかを判定する。
Trait Implementations§
Source§impl Clone for HierarchicalMapping
impl Clone for HierarchicalMapping
Source§fn clone(&self) -> HierarchicalMapping
fn clone(&self) -> HierarchicalMapping
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HierarchicalMapping
impl Debug for HierarchicalMapping
Source§impl<'de> Deserialize<'de> for HierarchicalMapping
impl<'de> Deserialize<'de> for HierarchicalMapping
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for HierarchicalMapping
Source§impl PartialEq for HierarchicalMapping
impl PartialEq for HierarchicalMapping
Source§impl Serialize for HierarchicalMapping
impl Serialize for HierarchicalMapping
impl StructuralPartialEq for HierarchicalMapping
Auto Trait Implementations§
impl Freeze for HierarchicalMapping
impl RefUnwindSafe for HierarchicalMapping
impl Send for HierarchicalMapping
impl Sync for HierarchicalMapping
impl Unpin for HierarchicalMapping
impl UnsafeUnpin for HierarchicalMapping
impl UnwindSafe for HierarchicalMapping
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more