#[non_exhaustive]pub struct TextVectorizationConfig {
pub max_tokens: Option<usize>,
pub standardize: Standardize,
pub split: Split,
pub ngrams: Option<usize>,
pub output_sequence_length: Option<usize>,
pub pad_to_max_tokens: bool,
pub limits: TextLimits,
}Expand description
TextVectorization の設定。Default と with_* ビルダで組み立てる。
既定値は max_tokens: None・standardize: LowerAndStripPunctuation・
split: Whitespace・ngrams: None・output_sequence_length: None・
limits: TextLimits::default()。Option のフィールドは with_* で Some を
設定する(None へ戻すには Default かフィールド代入)。値の検査は
ビルダでは行わず、TextVectorization::from_vocabulary/adapt の構築時に行う。
max_tokens: 予約 2 件を含む語彙数の上限。2 以下はInvalidMaxTokensngrams:Some(n)で 1〜n-gram を作る(nは 1 以上かつlimitsの上限以下)output_sequence_length:Some(L)でLへ切り詰め/0 埋め。Noneは バッチ内の最長に合わせる(出力モード系メソッドでは無視される)pad_to_max_tokens: 既定false。trueなら出力モード系メソッドの列数をmax_tokensに固定する(max_tokensがNoneだと構築時にPadToMaxTokensWithoutMaxTokens)。falseは語彙数(予約 2 件を含む)
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_tokens: Option<usize>予約 2 件を含む語彙数の上限。None は無制限(limits の上限は適用される)。
standardize: Standardize標準化の方式(既定は ASCII。Unicode 小文字化は UnicodeLower で opt-in)。
split: Split分割の方式(既定は ASCII 空白。Unicode White_Space は UnicodeWhitespace で opt-in)。
ngrams: Option<usize>Some(n) なら 1〜n-gram を作る。
output_sequence_length: Option<usize>Some(L) なら出力長を L に固定する。
pad_to_max_tokens: bool出力モード系メソッドの列数を max_tokens へ固定するか(既定 false)。
limits: TextLimits非信頼入力の上限。
Implementations§
Source§impl TextVectorizationConfig
impl TextVectorizationConfig
Sourcepub fn with_max_tokens(self, max_tokens: usize) -> Self
pub fn with_max_tokens(self, max_tokens: usize) -> Self
max_tokens に Some(max_tokens) を設定する。
Sourcepub fn with_standardize(self, standardize: Standardize) -> Self
pub fn with_standardize(self, standardize: Standardize) -> Self
標準化の方式を設定する。
Sourcepub fn with_split(self, split: Split) -> Self
pub fn with_split(self, split: Split) -> Self
分割の方式を設定する。
Sourcepub fn with_ngrams(self, n: usize) -> Self
pub fn with_ngrams(self, n: usize) -> Self
ngrams に Some(n) を設定する。
Sourcepub fn with_output_sequence_length(self, len: usize) -> Self
pub fn with_output_sequence_length(self, len: usize) -> Self
output_sequence_length に Some(len) を設定する。
Sourcepub fn with_pad_to_max_tokens(self, pad: bool) -> Self
pub fn with_pad_to_max_tokens(self, pad: bool) -> Self
pad_to_max_tokens を設定する。true には max_tokens の指定が必要。
Sourcepub fn with_limits(self, limits: TextLimits) -> Self
pub fn with_limits(self, limits: TextLimits) -> Self
非信頼入力の上限を設定する。
Trait Implementations§
Source§impl Clone for TextVectorizationConfig
impl Clone for TextVectorizationConfig
Source§impl Debug for TextVectorizationConfig
impl Debug for TextVectorizationConfig
Source§impl Default for TextVectorizationConfig
impl Default for TextVectorizationConfig
impl Eq for TextVectorizationConfig
Source§impl PartialEq for TextVectorizationConfig
impl PartialEq for TextVectorizationConfig
impl StructuralPartialEq for TextVectorizationConfig
Auto Trait Implementations§
impl Freeze for TextVectorizationConfig
impl RefUnwindSafe for TextVectorizationConfig
impl Send for TextVectorizationConfig
impl Sync for TextVectorizationConfig
impl Unpin for TextVectorizationConfig
impl UnsafeUnpin for TextVectorizationConfig
impl UnwindSafe for TextVectorizationConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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