pub struct TokenizerBuilder { /* private fields */ }Implementations§
Source§impl TokenizerBuilder
impl TokenizerBuilder
pub fn new() -> LinderaResult<Self>
pub fn from_file(file_path: &Path) -> LinderaResult<Self>
pub fn from_config(config: TokenizerConfig) -> LinderaResult<Self>
pub fn set_segmenter_mode(&mut self, mode: &Mode) -> &mut Self
pub fn set_segmenter_dictionary(&mut self, uri: &str) -> &mut Self
pub fn set_segmenter_user_dictionary(&mut self, uri: &str) -> &mut Self
pub fn set_segmenter_keep_whitespace( &mut self, keep_whitespace: bool, ) -> &mut Self
Sourcepub fn set_segmenter_max_grouping_len(
&mut self,
max_grouping_len: usize,
) -> &mut Self
pub fn set_segmenter_max_grouping_len( &mut self, max_grouping_len: usize, ) -> &mut Self
Sourcepub fn set_segmenter_unknown_word_ladder(
&mut self,
unknown_word_ladder: bool,
) -> &mut Self
pub fn set_segmenter_unknown_word_ladder( &mut self, unknown_word_ladder: bool, ) -> &mut Self
Sourcepub fn set_segmenter_space_penalty(
&mut self,
space_penalty: Option<&SpacePenaltyConfig>,
) -> &mut Self
pub fn set_segmenter_space_penalty( &mut self, space_penalty: Option<&SpacePenaltyConfig>, ) -> &mut Self
Sets the left-space penalty rules (see Segmenter::space_penalty).
Pass None to turn the penalty off (space_penalty: false), which
also overrides the rules the dictionary ships and applies by default;
leave the key unset to keep those.
§Arguments
space_penalty- The rules, orNoneto disable the penalty.
§Returns
A mutable reference to self, for chaining.
Sourcepub fn set_segmenter_space_penalty_from_dictionary(
&mut self,
enabled: bool,
) -> &mut Self
pub fn set_segmenter_space_penalty_from_dictionary( &mut self, enabled: bool, ) -> &mut Self
Enables the left-space penalty with the rules the dictionary ships in
its metadata.json (see Segmenter::space_penalty_from_dictionary),
i.e. space_penalty: true in the config; false turns it off. The
shipped rules are already the default when the key is absent, so
true mainly makes a dictionary that ships none fail loudly.
§Arguments
enabled- Whether to use the dictionary’s rules.
§Returns
A mutable reference to self, for chaining.
Sourcepub fn reset_segmenter_space_penalty(&mut self) -> &mut Self
pub fn reset_segmenter_space_penalty(&mut self) -> &mut Self
Removes any left-space penalty setting, so the Segmenter falls back to
its default: the rules the dictionary ships, if any. This undoes
Self::set_segmenter_space_penalty and
Self::set_segmenter_space_penalty_from_dictionary.
§Returns
A mutable reference to self, for chaining.
Sourcepub fn set_segmenter_use_mmap(&mut self, use_mmap: bool) -> &mut Self
pub fn set_segmenter_use_mmap(&mut self, use_mmap: bool) -> &mut Self
pub fn append_character_filter(&mut self, kind: &str, args: &Value) -> &mut Self
pub fn append_token_filter(&mut self, kind: &str, args: &Value) -> &mut Self
pub fn build(&self) -> LinderaResult<Tokenizer>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TokenizerBuilder
impl RefUnwindSafe for TokenizerBuilder
impl Send for TokenizerBuilder
impl Sync for TokenizerBuilder
impl Unpin for TokenizerBuilder
impl UnsafeUnpin for TokenizerBuilder
impl UnwindSafe for TokenizerBuilder
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
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 moreSource§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>
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
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.