pub struct JsTokenizer { /* private fields */ }Expand description
Tokenizer for performing morphological analysis.
The tokenizer processes text and returns tokens with their morphological features.
Implementations§
Source§impl JsTokenizer
impl JsTokenizer
Sourcepub fn new(
dictionary: &JsDictionary,
mode: Option<String>,
user_dictionary: Option<&JsUserDictionary>,
) -> Result<Self>
pub fn new( dictionary: &JsDictionary, mode: Option<String>, user_dictionary: Option<&JsUserDictionary>, ) -> Result<Self>
Creates a new tokenizer with the given dictionary and mode.
§Arguments
dictionary- Dictionary to use for tokenization.mode- Tokenization mode (“normal” or “decompose”). Default: “normal”.user_dictionary- Optional user dictionary for custom words.
Sourcepub fn tokenize_nbest(
&self,
text: String,
n: u32,
unique: Option<bool>,
cost_threshold: Option<i64>,
) -> Result<Vec<JsNbestResult>>
pub fn tokenize_nbest( &self, text: String, n: u32, unique: Option<bool>, cost_threshold: Option<i64>, ) -> Result<Vec<JsNbestResult>>
Tokenizes the given text and returns N-best results.
§Arguments
text- Text to tokenize.n- Number of N-best results to return.unique- If true, deduplicate results (default: false).cost_threshold- Maximum cost difference from the best path (default: undefined).
§Returns
An array of NbestResult objects, each containing tokens and their cost.
Trait Implementations§
Source§impl FromNapiMutRef for JsTokenizer
impl FromNapiMutRef for JsTokenizer
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 JsTokenizer
impl FromNapiRef for JsTokenizer
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 JsTokenizer
impl JavaScriptClassExt for JsTokenizer
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 ToNapiValue for JsTokenizer
impl ToNapiValue for JsTokenizer
Source§unsafe fn to_napi_value(env: napi_env, val: JsTokenizer) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: JsTokenizer) -> Result<napi_value>
Safety Read more
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeName for &JsTokenizer
impl TypeName for &JsTokenizer
Source§impl TypeName for &mut JsTokenizer
impl TypeName for &mut JsTokenizer
Source§impl TypeName for JsTokenizer
impl TypeName for JsTokenizer
Source§impl ValidateNapiValue for &JsTokenizer
impl ValidateNapiValue for &JsTokenizer
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 JsTokenizer
impl ValidateNapiValue for &mut JsTokenizer
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 JsTokenizer
impl !RefUnwindSafe for JsTokenizer
impl Send for JsTokenizer
impl Sync for JsTokenizer
impl Unpin for JsTokenizer
impl UnsafeUnpin for JsTokenizer
impl !UnwindSafe for JsTokenizer
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.