pub struct UserDictionary { /* private fields */ }Expand description
사용자 정의 사전
사용자가 커스텀 단어를 추가하여 형태소 분석을 개선할 수 있습니다.
Implementations§
Source§impl UserDictionary
impl UserDictionary
Sourcepub fn new() -> UserDictionary
pub fn new() -> UserDictionary
새 사용자 사전 생성
Sourcepub const fn with_default_cost(self, cost: i16) -> UserDictionary
pub const fn with_default_cost(self, cost: i16) -> UserDictionary
기본 비용 설정
Sourcepub fn add_entry(
&mut self,
surface: impl Into<String>,
pos: impl Into<String>,
cost: Option<i16>,
reading: Option<String>,
) -> &mut UserDictionary
pub fn add_entry( &mut self, surface: impl Into<String>, pos: impl Into<String>, cost: Option<i16>, reading: Option<String>, ) -> &mut UserDictionary
엔트리 추가
§Arguments
surface- 표면형pos- 품사 태그 (예: “NNG”, “NNP”, “VV”)cost- 비용 (낮을수록 우선, None이면 기본값 사용)reading- 읽기 (발음, 선택)
Sourcepub fn add_entry_with_ids(
&mut self,
surface: impl Into<String>,
pos: impl Into<String>,
cost: i16,
left_id: u16,
right_id: u16,
reading: Option<String>,
) -> &mut UserDictionary
pub fn add_entry_with_ids( &mut self, surface: impl Into<String>, pos: impl Into<String>, cost: i16, left_id: u16, right_id: u16, reading: Option<String>, ) -> &mut UserDictionary
컨텍스트 ID와 함께 엔트리 추가
Sourcepub fn load_from_csv<P>(
&mut self,
path: P,
) -> Result<&mut UserDictionary, DictError>
pub fn load_from_csv<P>( &mut self, path: P, ) -> Result<&mut UserDictionary, DictError>
Sourcepub fn load_from_str(
&mut self,
content: &str,
) -> Result<&mut UserDictionary, DictError>
pub fn load_from_str( &mut self, content: &str, ) -> Result<&mut UserDictionary, DictError>
Sourcepub fn common_prefix_search(&self, text: &str) -> Vec<&UserEntry>
pub fn common_prefix_search(&self, text: &str) -> Vec<&UserEntry>
Sourcepub fn build_trie(&mut self) -> Result<&[u8], DictError>
pub fn build_trie(&mut self) -> Result<&[u8], DictError>
Sourcepub fn to_entries(&self) -> Vec<Entry>
pub fn to_entries(&self) -> Vec<Entry>
Entry 목록으로 변환
Sourcepub fn validate(&self) -> ValidationResult
pub fn validate(&self) -> ValidationResult
Sourcepub fn remove_duplicates(&mut self)
pub fn remove_duplicates(&mut self)
중복 엔트리 제거
같은 표면형과 품사를 가진 엔트리 중 첫 번째만 유지합니다.
Sourcepub fn remove_surface(&mut self, surface: &str) -> usize
pub fn remove_surface(&mut self, surface: &str) -> usize
Sourcepub fn add_entry_auto_pos(
&mut self,
surface: impl Into<String>,
cost: Option<i16>,
reading: Option<String>,
) -> &mut UserDictionary
pub fn add_entry_auto_pos( &mut self, surface: impl Into<String>, cost: Option<i16>, reading: Option<String>, ) -> &mut UserDictionary
자동 품사 추정을 사용하여 엔트리 추가
표면형만 제공하면 품사를 자동으로 추정합니다.
Sourcepub fn check_system_conflicts<S>(
&self,
system_surfaces: &HashSet<String, S>,
) -> Vec<(usize, String, String)>where
S: BuildHasher,
pub fn check_system_conflicts<S>(
&self,
system_surfaces: &HashSet<String, S>,
) -> Vec<(usize, String, String)>where
S: BuildHasher,
Sourcepub fn stats(&self) -> DictionaryStats
pub fn stats(&self) -> DictionaryStats
통계 정보 반환
Trait Implementations§
Source§impl Clone for UserDictionary
impl Clone for UserDictionary
Source§fn clone(&self) -> UserDictionary
fn clone(&self) -> UserDictionary
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for UserDictionary
impl Default for UserDictionary
Source§fn default() -> UserDictionary
fn default() -> UserDictionary
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UserDictionary
impl RefUnwindSafe for UserDictionary
impl Send for UserDictionary
impl Sync for UserDictionary
impl Unpin for UserDictionary
impl UnsafeUnpin for UserDictionary
impl UnwindSafe for UserDictionary
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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