#[repr(C)]pub struct NLEmbedding {
pub ptr: Id<Object>,
}Expand description
A map of strings to vectors, which locates neighboring, similar strings.
Fields§
§ptr: Id<Object>The raw pointer to the Objective-C object.
Implementations§
Source§impl NLEmbedding
impl NLEmbedding
Sourcepub fn word_embedding_for_language(language: NLLanguage) -> Option<NLEmbedding>
pub fn word_embedding_for_language(language: NLLanguage) -> Option<NLEmbedding>
Retrieves a word embedding for a given language.
Sourcepub fn word_embedding_for_language_revision(
language: NLLanguage,
revision: UInt,
) -> Option<NLEmbedding>
pub fn word_embedding_for_language_revision( language: NLLanguage, revision: UInt, ) -> Option<NLEmbedding>
Retrieves a word embedding for a given language and revision.
Sourcepub fn embedding_with_contents_of_url(url: &NSURL) -> Result<Self, NSError>
pub fn embedding_with_contents_of_url(url: &NSURL) -> Result<Self, NSError>
Creates a word embedding from a model file.
Sourcepub fn sentence_embedding_for_language(
language: NLLanguage,
) -> Option<NLEmbedding>
pub fn sentence_embedding_for_language( language: NLLanguage, ) -> Option<NLEmbedding>
Retrieves a sentence embedding for a given language.
Sourcepub fn sentence_embedding_for_language_revision(
language: NLLanguage,
revision: UInt,
) -> Option<NLEmbedding>
pub fn sentence_embedding_for_language_revision( language: NLLanguage, revision: UInt, ) -> Option<NLEmbedding>
Retrieves a sentence embedding for a given language and revision.
Sourcepub fn neighbors_for_string_maximum_count_distance_type(
&self,
string: &NSString,
max_count: UInt,
distance_type: NLDistanceType,
) -> NSArray<NSString>
pub fn neighbors_for_string_maximum_count_distance_type( &self, string: &NSString, max_count: UInt, distance_type: NLDistanceType, ) -> NSArray<NSString>
Retrieves a limited number of strings near a string in the vocabulary.
Sourcepub fn neighbors_for_string_maximum_count_maximum_distance_distance_type(
&self,
string: &NSString,
max_count: UInt,
max_distance: NLDistance,
distance_type: NLDistanceType,
) -> NSArray<NSString>
pub fn neighbors_for_string_maximum_count_maximum_distance_distance_type( &self, string: &NSString, max_count: UInt, max_distance: NLDistance, distance_type: NLDistanceType, ) -> NSArray<NSString>
Retrieves a limited number of strings, within a radius of a string, in the vocabulary.
Sourcepub fn neighbors_for_vector_maximum_count_distance_type(
&self,
vector: &NSArray<NSNumber>,
max_count: UInt,
distance_type: NLDistanceType,
) -> NSArray<NSString>
pub fn neighbors_for_vector_maximum_count_distance_type( &self, vector: &NSArray<NSNumber>, max_count: UInt, distance_type: NLDistanceType, ) -> NSArray<NSString>
Retrieves a limited number of strings near a location in the vocabulary space.
Sourcepub fn neighbors_for_vector_maximum_count_maximum_distance_distance_type(
&self,
vector: &NSArray<NSNumber>,
max_count: UInt,
max_distance: NLDistance,
distance_type: NLDistanceType,
) -> NSArray<NSString>
pub fn neighbors_for_vector_maximum_count_maximum_distance_distance_type( &self, vector: &NSArray<NSNumber>, max_count: UInt, max_distance: NLDistance, distance_type: NLDistanceType, ) -> NSArray<NSString>
Retrieves a limited number of strings within a radius of a location in the vocabulary space.
Sourcepub fn enumerate_neighbors_for_string_maximum_count_distance_type_using_block<F>(
&self,
string: &NSString,
max_count: UInt,
distance_type: NLDistanceType,
block: F,
)
pub fn enumerate_neighbors_for_string_maximum_count_distance_type_using_block<F>( &self, string: &NSString, max_count: UInt, distance_type: NLDistanceType, block: F, )
Passes the nearest strings of a string in the vocabulary to a block.
Sourcepub fn enumerate_neighbors_for_string_maximum_count_maximum_distance_distance_type_using_block<F>(
&self,
string: &NSString,
max_count: UInt,
max_distance: NLDistance,
distance_type: NLDistanceType,
block: F,
)
pub fn enumerate_neighbors_for_string_maximum_count_maximum_distance_distance_type_using_block<F>( &self, string: &NSString, max_count: UInt, max_distance: NLDistance, distance_type: NLDistanceType, block: F, )
Passes the nearest strings, within a radius of a string in the vocabulary, to a block.
Sourcepub fn enumerate_neighbors_for_vector_maximum_count_distance_type_using_block<F>(
&self,
vector: &NSArray<NSNumber>,
max_count: UInt,
distance_type: NLDistanceType,
block: F,
)
pub fn enumerate_neighbors_for_vector_maximum_count_distance_type_using_block<F>( &self, vector: &NSArray<NSNumber>, max_count: UInt, distance_type: NLDistanceType, block: F, )
Passes the nearest strings of a location in the vocabulary space to a block.
Sourcepub fn enumerate_neighbors_for_vector_maximum_count_maximum_distance_distance_type_using_block<F>(
&self,
vector: &NSArray<NSNumber>,
max_count: UInt,
max_distance: NLDistance,
distance_type: NLDistanceType,
block: F,
)
pub fn enumerate_neighbors_for_vector_maximum_count_maximum_distance_distance_type_using_block<F>( &self, vector: &NSArray<NSNumber>, max_count: UInt, max_distance: NLDistance, distance_type: NLDistanceType, block: F, )
Passes the nearest strings, within a radius of a location in the vocabulary space, to a block.
Sourcepub fn distance_between_string_and_string_distance_type(
&self,
first: &NSString,
second: &NSString,
distance_type: NLDistanceType,
) -> NLDistance
pub fn distance_between_string_and_string_distance_type( &self, first: &NSString, second: &NSString, distance_type: NLDistanceType, ) -> NLDistance
Calculates the distance between two strings in the vocabulary space.
Sourcepub fn vocabulary_size(&self) -> UInt
pub fn vocabulary_size(&self) -> UInt
The number of words in the vocabulary.
Sourcepub fn language(&self) -> Option<NLLanguage>
pub fn language(&self) -> Option<NLLanguage>
The language of the text in the word embedding.
Sourcepub fn contains_string(&self, string: &NSString) -> bool
pub fn contains_string(&self, string: &NSString) -> bool
Requests a Boolean value that indicates whether the term is in the vocabulary.
Sourcepub fn vector_for_string(&self, string: &NSString) -> NSArray<NSNumber>
pub fn vector_for_string(&self, string: &NSString) -> NSArray<NSNumber>
Requests the vector for the given term.
Sourcepub fn get_vector_for_string(
&self,
vector: &mut [c_float],
string: &NSString,
) -> bool
pub fn get_vector_for_string( &self, vector: &mut [c_float], string: &NSString, ) -> bool
Copies a vector into the given a pointer to a float array.
Sourcepub fn write_embedding_for_dictionary_language_revision_to_url(
dictionary: &NSDictionary<NSString, NSArray<NSNumber>>,
language: NLLanguage,
revision: UInt,
url: &NSURL,
) -> Result<bool, NSError>
pub fn write_embedding_for_dictionary_language_revision_to_url( dictionary: &NSDictionary<NSString, NSArray<NSNumber>>, language: NLLanguage, revision: UInt, url: &NSURL, ) -> Result<bool, NSError>
Exports the word embedding contained within a Core ML model file at the given URL.
Sourcepub fn current_revision_for_language(language: NLLanguage) -> UInt
pub fn current_revision_for_language(language: NLLanguage) -> UInt
Retrieves the current version of a word embedding for the given language.
Sourcepub fn supported_revisions_for_language(language: NLLanguage) -> NSIndexSet
pub fn supported_revisions_for_language(language: NLLanguage) -> NSIndexSet
Retrieves all version numbers of a word embedding for the given language.
Sourcepub fn current_sentence_embedding_revision_for_language(
language: NLLanguage,
) -> UInt
pub fn current_sentence_embedding_revision_for_language( language: NLLanguage, ) -> UInt
Retrieves the current version of a sentence embedding for the given language.
Sourcepub fn supported_sentence_embedding_revisions_for_language(
language: NLLanguage,
) -> NSIndexSet
pub fn supported_sentence_embedding_revisions_for_language( language: NLLanguage, ) -> NSIndexSet
Retrieves all version numbers of a sentence embedding for the given language.
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.