pub struct KeywordExtractConfig { /* private fields */ }
Expand description
Creates a KeywordExtractConfig state that contains filter criteria as well as segmentation configuration for use by keyword extraction implementations.
Use KeywordExtractConfigBuilder to change the defaults.
§Examples
use jieba_rs::KeywordExtractConfig;
let mut config = KeywordExtractConfig::default();
assert!(config.stop_words().contains("the"));
assert!(!config.stop_words().contains("FakeWord"));
assert!(!config.use_hmm());
assert_eq!(2, config.min_keyword_length());
let built_default = KeywordExtractConfig::builder().build().unwrap();
assert_eq!(config, built_default);
let changed = KeywordExtractConfig::builder()
.add_stop_word("FakeWord".to_string())
.remove_stop_word("the")
.use_hmm(true)
.min_keyword_length(10)
.build().unwrap();
assert!(!changed.stop_words().contains("the"));
assert!(changed.stop_words().contains("FakeWord"));
assert!(changed.use_hmm());
assert_eq!(10, changed.min_keyword_length());
Implementations§
Source§impl KeywordExtractConfig
impl KeywordExtractConfig
pub fn builder() -> KeywordExtractConfigBuilder
Sourcepub fn stop_words(&self) -> &BTreeSet<String>
pub fn stop_words(&self) -> &BTreeSet<String>
Get current set of stop words.
Sourcepub fn min_keyword_length(&self) -> usize
pub fn min_keyword_length(&self) -> usize
Gets the minimum number of Unicode Scalar Values required per keyword.
Trait Implementations§
Source§impl Clone for KeywordExtractConfig
impl Clone for KeywordExtractConfig
Source§fn clone(&self) -> KeywordExtractConfig
fn clone(&self) -> KeywordExtractConfig
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for KeywordExtractConfig
impl Debug for KeywordExtractConfig
Source§impl Default for KeywordExtractConfig
impl Default for KeywordExtractConfig
Source§fn default() -> KeywordExtractConfig
fn default() -> KeywordExtractConfig
Returns the “default value” for a type. Read more
Source§impl PartialEq for KeywordExtractConfig
impl PartialEq for KeywordExtractConfig
impl StructuralPartialEq for KeywordExtractConfig
Auto Trait Implementations§
impl Freeze for KeywordExtractConfig
impl RefUnwindSafe for KeywordExtractConfig
impl Send for KeywordExtractConfig
impl Sync for KeywordExtractConfig
impl Unpin for KeywordExtractConfig
impl UnwindSafe for KeywordExtractConfig
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
Mutably borrows from an owned value. Read more