pub struct JsTokenizerBuilder { /* private fields */ }Expand description
Builder for creating a Tokenizer with custom configuration.
The builder pattern allows for fluent configuration of tokenizer parameters including dictionaries, modes, and filter pipelines.
Implementations§
Source§impl JsTokenizerBuilder
impl JsTokenizerBuilder
Sourcepub fn from_file(&self, file_path: String) -> Result<JsTokenizerBuilder>
pub fn from_file(&self, file_path: String) -> Result<JsTokenizerBuilder>
Sourcepub fn set_dictionary(&mut self, path: String)
pub fn set_dictionary(&mut self, path: String)
Sets the dictionary path or URI.
§Arguments
path- Path to the dictionary directory or embedded URI (e.g. “embedded://ipadic”).
Sourcepub fn set_user_dictionary(&mut self, uri: String)
pub fn set_user_dictionary(&mut self, uri: String)
Sourcepub fn set_keep_whitespace(&mut self, keep_whitespace: bool)
pub fn set_keep_whitespace(&mut self, keep_whitespace: bool)
Sets whether to keep whitespace in tokenization results.
§Arguments
keep_whitespace- If true, whitespace tokens will be included in results.
Sourcepub fn append_character_filter(
&mut self,
kind: String,
args: Option<Value>,
) -> Result<()>
pub fn append_character_filter( &mut self, kind: String, args: Option<Value>, ) -> Result<()>
Appends a character filter to the preprocessing pipeline.
§Arguments
kind- Type of character filter to add (e.g. “unicode_normalize”, “mapping”).args- Optional filter arguments as a JSON-compatible object.
Sourcepub fn append_token_filter(
&mut self,
kind: String,
args: Option<Value>,
) -> Result<()>
pub fn append_token_filter( &mut self, kind: String, args: Option<Value>, ) -> Result<()>
Appends a token filter to the postprocessing pipeline.
§Arguments
kind- Type of token filter to add (e.g. “lowercase”, “japanese_stop_tags”).args- Optional filter arguments as a JSON-compatible object.
Sourcepub fn build(&self) -> Result<JsTokenizer>
pub fn build(&self) -> Result<JsTokenizer>
Builds the tokenizer with the configured settings.
§Returns
A configured Tokenizer instance ready for use.
Trait Implementations§
Source§impl FromNapiMutRef for JsTokenizerBuilder
impl FromNapiMutRef for JsTokenizerBuilder
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for JsTokenizerBuilder
impl FromNapiRef for JsTokenizerBuilder
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl JavaScriptClassExt for JsTokenizerBuilder
impl JavaScriptClassExt for JsTokenizerBuilder
fn into_instance<'scope>( self, env: &'scope Env, ) -> Result<ClassInstance<'scope, Self>>
fn into_reference(self, env: Env) -> Result<Reference<Self>>
fn instance_of<'env, V: JsValue<'env>>(env: &Env, value: &V) -> Result<bool>
Source§impl ObjectFinalize for JsTokenizerBuilder
impl ObjectFinalize for JsTokenizerBuilder
Source§impl ToNapiValue for JsTokenizerBuilder
impl ToNapiValue for JsTokenizerBuilder
Source§unsafe fn to_napi_value(
env: napi_env,
val: JsTokenizerBuilder,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: JsTokenizerBuilder, ) -> Result<napi_value>
Safety Read more
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeName for &JsTokenizerBuilder
impl TypeName for &JsTokenizerBuilder
Source§impl TypeName for &mut JsTokenizerBuilder
impl TypeName for &mut JsTokenizerBuilder
Source§impl TypeName for JsTokenizerBuilder
impl TypeName for JsTokenizerBuilder
Source§impl ValidateNapiValue for &JsTokenizerBuilder
impl ValidateNapiValue for &JsTokenizerBuilder
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut JsTokenizerBuilder
impl ValidateNapiValue for &mut JsTokenizerBuilder
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for JsTokenizerBuilder
impl RefUnwindSafe for JsTokenizerBuilder
impl Send for JsTokenizerBuilder
impl Sync for JsTokenizerBuilder
impl Unpin for JsTokenizerBuilder
impl UnsafeUnpin for JsTokenizerBuilder
impl UnwindSafe for JsTokenizerBuilder
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
impl<T> JsValuesTupleIntoVec for Twhere
T: ToNapiValue,
fn into_vec(self, env: *mut napi_env__) -> Result<Vec<*mut napi_value__>, Error>
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.