Platforms to show: All Mac Windows Linux Cross-Platform

NLContextualEmbeddingMBS class   New in 26.2

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Natural Language MBS MacFrameworks Plugin 26.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A model that computes sequences of embedding vectors for natural language utterances.

NLContextualEmbeddingMBS provides a dense vector representation of natural language utterances using models trained with contextualized language understanding. Unlike static word embeddings provided by NLEmbeddingMBS, contextual embeddings dynamically adjust based on surrounding words, enabling deeper language comprehension.

If you are building text classification or word tagging models, you can use NLContextualEmbeddingMBS with Create ML by selecting MLTextClassifier.FeatureExtractorType.bertEmbedding as the feature extraction component in your model. For more information on how to create your own text classification model refer to Creating a text classifier model.

Note
For semantic similarity tasks, consider using NLEmbeddingMBS. To learn more on how to implement semantic similarity, refer to Finding similarities between pieces of text.

Before configuring your contextual embedding:

  • Select a model that’s appropriate for your target language when initializing the embedding.
  • Call requestEmbeddingAssetsWithCompletionHandler: before computing the embedding to confirm assets are available.
Some models support multiple languages; for example, you can use the same object to compute embeddings for both English and Spanish. However, this isn’t always the case — languages like English and Chinese may require separate models. For more information about supported languages, refer to languages.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

RequestEmbeddingAssets Results

Constant Value Description
NLContextualEmbeddingAssetsResultAvailable 0 A result that indicates that the assets are present on-device.
NLContextualEmbeddingAssetsResultError 2 A result that indicates the framework encounters an error.
NLContextualEmbeddingAssetsResultNotAvailable 1 A result that indicates that the assets aren’t present on-device.

This class has no sub classes.

Blog Entries

Release notes

  • Version 26.2
    • Added NLContextualEmbeddingMBS, NLContextualEmbeddingResultMBS and NLContextualEmbeddingResultVectorMBS classes.

Some related classes:


The items on this page are in the following plugins: MBS MacFrameworks Plugin.


NikonSizeMBS   -   NLContextualEmbeddingResultMBS


The biggest plugin in space...