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 |
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.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.
- event requestEmbeddingAssetsCompleted(result as Integer, error as NSErrorMBS)
- 6 properties
- property dimension as UInt64
- property Handle as Integer
- property hasAvailableAssets as Boolean
- property maximumSequenceLength as UInt64
- property modelIdentifier as String
- property revision as UInt64
- 7 methods
- method Constructor Private
- method embeddingResultForString(Text as String, Language as String = "", byref Error as NSErrorMBS) as NLContextualEmbeddingResultMBS
- method languages as String()
- method Load(byref error as NSErrorMBS) as Boolean
- method requestEmbeddingAssets
- method scripts as String()
- method unload
- 8 shared methods
- shared method available as boolean
- shared method contextualEmbeddingsForValues(values as Dictionary) as NLContextualEmbeddingMBS()
- shared method contextualEmbeddingWithLanguage(language as String) as NLContextualEmbeddingMBS
- shared method contextualEmbeddingWithModelIdentifier(modelIdentifier as String) as NLContextualEmbeddingMBS
- shared method contextualEmbeddingWithScript(script as String) as NLContextualEmbeddingMBS
- shared method NLContextualEmbeddingKeyLanguages as String
- shared method NLContextualEmbeddingKeyRevision as String
- shared method NLContextualEmbeddingKeyScripts as String
- 3 constants
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:
- class NLContextualEmbeddingResultMBS
- class NLContextualEmbeddingResultVectorMBS
- class NLEmbeddingMBS
- class NSErrorMBS
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
NikonSizeMBS - NLContextualEmbeddingResultMBS