#[repr(C)]pub struct NLModel {
pub ptr: Id<Object>,
}
Expand description
A custom model trained to classify or tag natural language text.
Fields§
§ptr: Id<Object>
The raw pointer to the Objective-C object.
Implementations§
Source§impl NLModel
impl NLModel
Sourcepub fn model_with_mlmodel(model: &MLModel) -> Result<Self, NSError>
pub fn model_with_mlmodel(model: &MLModel) -> Result<Self, NSError>
Creates a new natural language model based on the given Core ML model instance.
Sourcepub fn model_with_contents_of_url(url: &NSURL) -> Result<Self, NSError>
pub fn model_with_contents_of_url(url: &NSURL) -> Result<Self, NSError>
Creates a new natural language model based on the given Core ML model instance.
Sourcepub fn predicted_label_for_string(&self, string: &NSString) -> Option<NSString>
pub fn predicted_label_for_string(&self, string: &NSString) -> Option<NSString>
Predicts a label for the given input string.
Sourcepub fn predicted_labels_for_tokens(
&self,
tokens: &NSArray<NSString>,
) -> NSArray<NSString>
pub fn predicted_labels_for_tokens( &self, tokens: &NSArray<NSString>, ) -> NSArray<NSString>
Predicts a label for each string in the given array.
Sourcepub fn predicted_label_hypotheses_for_string_maximum_count(
&self,
string: &NSString,
max_count: UInt,
) -> NSDictionary<NSString, NSNumber>
pub fn predicted_label_hypotheses_for_string_maximum_count( &self, string: &NSString, max_count: UInt, ) -> NSDictionary<NSString, NSNumber>
Predicts multiple possible labels for the given input string.
Sourcepub fn predicted_label_hypotheses_for_tokens_maximum_count(
&self,
tokens: &NSArray<NSString>,
max_count: UInt,
) -> NSArray<NSDictionary<NSString, NSNumber>>
pub fn predicted_label_hypotheses_for_tokens_maximum_count( &self, tokens: &NSArray<NSString>, max_count: UInt, ) -> NSArray<NSDictionary<NSString, NSNumber>>
Predicts multiple possible labels for each token in the given array.
Sourcepub fn configuration(&self) -> NLModelConfiguration
pub fn configuration(&self) -> NLModelConfiguration
A configuration describing the natural language model.
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
.