pub struct Normalizer { /* private fields */ }Expand description
외래어 정규화기
Implementations§
Source§impl Normalizer
impl Normalizer
Sourcepub fn new(config: NormalizationConfig) -> Result<Self>
pub fn new(config: NormalizationConfig) -> Result<Self>
Sourcepub fn with_data_file(
config: NormalizationConfig,
variant_csv_path: &Path,
) -> Result<Self>
pub fn with_data_file( config: NormalizationConfig, variant_csv_path: &Path, ) -> Result<Self>
Sourcepub fn normalize(&self, text: &str) -> String
pub fn normalize(&self, text: &str) -> String
외래어를 표준형으로 정규화
§Arguments
text- 정규화할 텍스트
§Returns
정규화된 텍스트
§Example
use mecab_ko_core::normalizer::{Normalizer, NormalizationConfig};
let normalizer = Normalizer::new(NormalizationConfig::default()).unwrap();
assert_eq!(normalizer.normalize("코피"), "커피");
assert_eq!(normalizer.normalize("소프트웨아"), "소프트웨어");Sourcepub fn get_variants(&self, standard: &str) -> Vec<String>
pub fn get_variants(&self, standard: &str) -> Vec<String>
표준형의 모든 변이형 조회
§Arguments
standard- 표준형 단어
§Returns
변이형 목록
§Example
use mecab_ko_core::normalizer::{Normalizer, NormalizationConfig};
let normalizer = Normalizer::new(NormalizationConfig::default()).unwrap();
let variants = normalizer.get_variants("커피");
assert!(variants.contains(&"코피".to_string()));Sourcepub fn is_variant(&self, word1: &str, word2: &str) -> bool
pub fn is_variant(&self, word1: &str, word2: &str) -> bool
두 단어가 변이형 관계인지 확인
§Arguments
word1- 첫 번째 단어word2- 두 번째 단어
§Returns
변이형 관계이면 true, 아니면 false
§Example
use mecab_ko_core::normalizer::{Normalizer, NormalizationConfig};
let normalizer = Normalizer::new(NormalizationConfig::default()).unwrap();
assert!(normalizer.is_variant("커피", "코피"));
assert!(!normalizer.is_variant("커피", "라면"));Auto Trait Implementations§
impl Freeze for Normalizer
impl RefUnwindSafe for Normalizer
impl Send for Normalizer
impl Sync for Normalizer
impl Unpin for Normalizer
impl UnsafeUnpin for Normalizer
impl UnwindSafe for Normalizer
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> 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