pub struct SejongConverter { /* private fields */ }Expand description
세종 코퍼스 형식 변환기
Implementations§
Source§impl SejongConverter
impl SejongConverter
Sourcepub const fn with_decomposition(self, use_decomposition: bool) -> Self
pub const fn with_decomposition(self, use_decomposition: bool) -> Self
분석결과 사용 여부 설정
true이면 mecab-ko-dic의 12번째 컬럼(분석결과)을 우선 사용합니다.
불규칙 활용을 정확하게 처리하려면 true로 설정하세요.
Sourcepub fn parse_decomposition(decomposition: &str) -> Vec<DecomposedMorpheme>
pub fn parse_decomposition(decomposition: &str) -> Vec<DecomposedMorpheme>
분석결과 컬럼에서 형태소 분해 정보 파싱
형식: stem/POS/*+ending/POS/*+...
예시: 가깝/VA/*+아/EC/* → [(“가깝”, “VA”), (“아”, “EC”)]
Sourcepub fn extract_decomposition(features: &str) -> Option<String>
pub fn extract_decomposition(features: &str) -> Option<String>
feature 문자열에서 분析결과(12번째 컬럼) 추출
mecab-ko-dic CSV 형식:
품사,의미분류,종성,읽기,타입,첫품사,끝품사,분석결과
(0~7, 총 8개 필드이지만 인덱스 7이 분析결과)
Sourcepub fn is_compound_tag(&self, pos: &str) -> bool
pub fn is_compound_tag(&self, pos: &str) -> bool
복합 품사 태그인지 확인
Sourcepub fn split_compound_tag(&self, pos: &str) -> Vec<String>
pub fn split_compound_tag(&self, pos: &str) -> Vec<String>
복합 품사 태그를 분리된 태그 목록으로 변환
Sourcepub fn convert_token(&self, token: &Token) -> Vec<SejongToken>
pub fn convert_token(&self, token: &Token) -> Vec<SejongToken>
토큰을 세종 형식으로 변환
변환 우선순위:
- 분析결과 컬럼 사용 (
use_decomposition=true, features에 분析결과 있는 경우) - 규칙 기반 어미 분리 (
ending_rules) - 태그만 분리 (복합 태그인 경우)
- 그대로 반환 (단순 태그인 경우)
Sourcepub fn convert_tokens(&self, tokens: &[Token]) -> Vec<SejongToken>
pub fn convert_tokens(&self, tokens: &[Token]) -> Vec<SejongToken>
토큰 목록을 세종 형식으로 변환
Sourcepub fn format_sejong(&self, tokens: &[SejongToken]) -> String
pub fn format_sejong(&self, tokens: &[SejongToken]) -> String
세종 형식 문자열로 변환 (자모 정규화 포함)
Sourcepub fn tokens_to_sejong_string(&self, tokens: &[Token]) -> String
pub fn tokens_to_sejong_string(&self, tokens: &[Token]) -> String
토큰을 세종 형식 문자열로 직접 변환
Sourcepub fn normalize_jamo(text: &str) -> String
pub fn normalize_jamo(text: &str) -> String
한글 자모 정규화 (외부 호환성 유지)
ㅏ, ㅓ, ㅣ 등 자모가 포함된 문자열을 완성형으로 변환합니다.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SejongConverter
impl RefUnwindSafe for SejongConverter
impl Send for SejongConverter
impl Sync for SejongConverter
impl Unpin for SejongConverter
impl UnsafeUnpin for SejongConverter
impl UnwindSafe for SejongConverter
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