pub struct KiwiToken {
pub form: String,
pub tag: KiwiPosTag,
pub start: usize,
pub length: usize,
pub score: f64,
}Expand description
Kiwi 호환 토큰 구조체
Kiwi 형태소 분석 결과와 호환되는 출력 형식
§Example
use mecab_ko_core::kiwi_compat::{KiwiToken, KiwiPosTag};
let token = KiwiToken {
form: "안녕".to_string(),
tag: KiwiPosTag::NNG,
start: 0,
length: 6, // UTF-8 바이트 길이
score: -10.5,
};
assert_eq!(token.form, "안녕");
assert_eq!(token.tag, KiwiPosTag::NNG);Fields§
§form: String형태소 표면형
tag: KiwiPosTag품사 태그
start: usize시작 위치 (바이트 오프셋)
length: usize길이 (바이트)
score: f64분석 점수 (로그 확률)
Implementations§
Source§impl KiwiToken
impl KiwiToken
Sourcepub fn new(
form: impl Into<String>,
tag: KiwiPosTag,
start: usize,
length: usize,
score: f64,
) -> Self
pub fn new( form: impl Into<String>, tag: KiwiPosTag, start: usize, length: usize, score: f64, ) -> Self
새 토큰 생성
§Example
use mecab_ko_core::kiwi_compat::{KiwiToken, KiwiPosTag};
let token = KiwiToken::new("하다", KiwiPosTag::VV, 0, 6, -5.2);
assert_eq!(token.form, "하다");Sourcepub const fn to_mecab_tag(&self) -> PosTag
pub const fn to_mecab_tag(&self) -> PosTag
MeCab-Ko 품사 태그로 변환
Trait Implementations§
impl StructuralPartialEq for KiwiToken
Auto Trait Implementations§
impl Freeze for KiwiToken
impl RefUnwindSafe for KiwiToken
impl Send for KiwiToken
impl Sync for KiwiToken
impl Unpin for KiwiToken
impl UnsafeUnpin for KiwiToken
impl UnwindSafe for KiwiToken
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