#[repr(C)]pub struct NLTokenizer {
pub ptr: Id<Object>,
}
Expand description
A tokenizer that segments natural language text into semantic units.
Fields§
§ptr: Id<Object>
The raw pointer to the Objective-C object.
Implementations§
Source§impl NLTokenizer
impl NLTokenizer
Sourcepub fn init_with_unit(&mut self, unit: NLTokenUnit) -> Self
pub fn init_with_unit(&mut self, unit: NLTokenUnit) -> Self
Creates a tokenizer with the specified unit.
Sourcepub fn set_string(&mut self, string: NSString)
pub fn set_string(&mut self, string: NSString)
Sets the text to be tokenized.
Sourcepub fn set_language(&mut self, language: NLLanguage)
pub fn set_language(&mut self, language: NLLanguage)
Sets the language of the text to be tokenized.
Sourcepub fn unit(&self) -> NLTokenUnit
pub fn unit(&self) -> NLTokenUnit
The linguistic unit that this tokenizer uses.
Sourcepub fn enumerate_tokens_in_range_using_block<F>(&self, range: NSRange, block: F)
pub fn enumerate_tokens_in_range_using_block<F>(&self, range: NSRange, block: F)
Enumerates over a given range of the string and calls the specified block for each token.
Sourcepub fn tokens_for_range<T>(&self, range: NSRange) -> NSArray<T>where
T: INSValue,
pub fn tokens_for_range<T>(&self, range: NSRange) -> NSArray<T>where
T: INSValue,
Tokenizes the string within the provided range.
Sourcepub fn token_range_at_index(&self, character_index: UInt) -> NSRange
pub fn token_range_at_index(&self, character_index: UInt) -> NSRange
Finds the range of the token at the given index.
Sourcepub fn token_range_for_range(&self, range: NSRange) -> NSRange
pub fn token_range_for_range(&self, range: NSRange) -> NSRange
Finds the entire range of all tokens contained completely or partially within the specified range.
Methods from Deref<Target = Object>§
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Returns a reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
Sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Returns a mutable reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.