Skip to main content

SejongConverter

Struct SejongConverter 

Source
pub struct SejongConverter { /* private fields */ }
Expand description

세종 코퍼스 형식 변환기

Implementations§

Source§

impl SejongConverter

Source

pub fn new() -> Self

기본 설정으로 변환기 생성

Source

pub const fn with_decomposition(self, use_decomposition: bool) -> Self

분석결과 사용 여부 설정

true이면 mecab-ko-dic의 12번째 컬럼(분석결과)을 우선 사용합니다. 불규칙 활용을 정확하게 처리하려면 true로 설정하세요.

Source

pub fn parse_decomposition(decomposition: &str) -> Vec<DecomposedMorpheme>

분석결과 컬럼에서 형태소 분해 정보 파싱

형식: stem/POS/*+ending/POS/*+... 예시: 가깝/VA/*+아/EC/* → [(“가깝”, “VA”), (“아”, “EC”)]

Source

pub fn extract_decomposition(features: &str) -> Option<String>

feature 문자열에서 분析결과(12번째 컬럼) 추출

mecab-ko-dic CSV 형식: 품사,의미분류,종성,읽기,타입,첫품사,끝품사,분석결과 (0~7, 총 8개 필드이지만 인덱스 7이 분析결과)

Source

pub fn is_compound_tag(&self, pos: &str) -> bool

복합 품사 태그인지 확인

Source

pub fn split_compound_tag(&self, pos: &str) -> Vec<String>

복합 품사 태그를 분리된 태그 목록으로 변환

Source

pub fn split_morpheme(&self, surface: &str, pos: &str) -> Vec<(String, String)>

표면형에서 어미를 분리

§Arguments
  • surface - 표면형 (예: “갔다”)
  • pos - 품사 태그 (예: “VV+EF”)
§Returns

분리된 (표면형, 품사) 쌍의 벡터

Source

pub fn convert_token(&self, token: &Token) -> Vec<SejongToken>

토큰을 세종 형식으로 변환

변환 우선순위:

  1. 분析결과 컬럼 사용 (use_decomposition=true, features에 분析결과 있는 경우)
  2. 규칙 기반 어미 분리 (ending_rules)
  3. 태그만 분리 (복합 태그인 경우)
  4. 그대로 반환 (단순 태그인 경우)
Source

pub fn convert_tokens(&self, tokens: &[Token]) -> Vec<SejongToken>

토큰 목록을 세종 형식으로 변환

Source

pub fn format_sejong(&self, tokens: &[SejongToken]) -> String

세종 형식 문자열로 변환 (자모 정규화 포함)

Source

pub fn tokens_to_sejong_string(&self, tokens: &[Token]) -> String

토큰을 세종 형식 문자열로 직접 변환

Source

pub fn normalize_jamo(text: &str) -> String

한글 자모 정규화 (외부 호환성 유지)

ㅏ, ㅓ, ㅣ 등 자모가 포함된 문자열을 완성형으로 변환합니다.

Trait Implementations§

Source§

impl Default for SejongConverter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.