Platforms to show: All Mac Windows Linux Cross-Platform

Back to NLLanguageRecognizerMBS class.

NLLanguageRecognizerMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a recognizer that you can customize.

NLLanguageRecognizerMBS.languageConstraints as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Limits the set of possible languages that the recognizer will return.

NLLanguageRecognizerMBS.languageHypothesesWithMaximum(maxHypotheses as Integer) as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Generates the probabilities of possible languages for the processed text.
Example
var recognizer as new NLLanguageRecognizerMBS

recognizer.processString("Hola amigos, cómo están?")

var hypotheses as Dictionary = recognizer.languageHypothesesWithMaximum(3)

For Each entry As DictionaryEntry In hypotheses

System.DebugLog entry.Key+": "+format(entry.Value.DoubleValue, "0.0%")

next

maxHypotheses: The maximum number of languages to return.

A dictionary mapping languages with their probabilities, up to maxHypotheses languages.

NLLanguageRecognizerMBS.processString(text as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Analyzes the piece of text to determine its dominant language.
Example
var recognizer as new NLLanguageRecognizerMBS

recognizer.processString("Bonjour tout le monde")

var language as string = recognizer.dominantLanguage
MessageBox "Detected language: "+language

Use this method to process the provided text and to update the dominantLanguage result and languageHypotheses() probabilities.

NLLanguageRecognizerMBS.reset

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Resets the recognizer.
Example
var recognizer as new NLLanguageRecognizerMBS
var text, lang as string

text = "Hallo Welt"
recognizer.processString(text)
lang = recognizer.dominantLanguage

MessageBox text + ": " + lang

recognizer.reset()

Text = "Ciao mondo"
recognizer.processString(Text)
lang = recognizer.dominantLanguage

MessageBox Text + ": " + lang

Resets the recognizer to its initial state.

NLLanguageRecognizerMBS.setLanguageConstraints(testDeviceIdentifiers() as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Natural Language MBS MacFrameworks Plugin 26.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Limits the set of possible languages that the recognizer will return.
Example
var recognizer as new NLLanguageRecognizerMBS
Var Text, lang As String

Var languageConstraints() As String

languageConstraints.add recognizer.NLLanguageEnglish
languageConstraints.add recognizer.NLLanguageItalian
languageConstraints.add recognizer.NLLanguagePortuguese

recognizer.setLanguageConstraints languageConstraints

// this is spanish, but let's see what it is closest to
text = "Hola amigo"
recognizer.processString(text)
lang = recognizer.dominantLanguage

MessageBox text + ": " + lang

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


The biggest plugin in space...