Skip to main content

TextVectorizationConfig

Struct TextVectorizationConfig 

Source
#[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 以下は InvalidMaxTokens
  • ngrams: 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

pub fn with_max_tokens(self, max_tokens: usize) -> Self

max_tokens に Some(max_tokens) を設定する。

Source

pub fn with_standardize(self, standardize: Standardize) -> Self

標準化の方式を設定する。

Source

pub fn with_split(self, split: Split) -> Self

分割の方式を設定する。

Source

pub fn with_ngrams(self, n: usize) -> Self

ngrams に Some(n) を設定する。

Source

pub fn with_output_sequence_length(self, len: usize) -> Self

output_sequence_length に Some(len) を設定する。

Source

pub fn with_pad_to_max_tokens(self, pad: bool) -> Self

pad_to_max_tokens を設定する。true には max_tokens の指定が必要。

Source

pub fn with_limits(self, limits: TextLimits) -> Self

非信頼入力の上限を設定する。

Trait Implementations§

Source§

impl Clone for TextVectorizationConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextVectorizationConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextVectorizationConfig

Source§

fn default() -> Self

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

impl Eq for TextVectorizationConfig

Source§

impl PartialEq for TextVectorizationConfig

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TextVectorizationConfig

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V