Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSLinguisticTaggerMBS class.

NSLinguisticTaggerMBS.Constructor(tagSchemes() as String, options as integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a linguistic tagger instance using the specified tag schemes and options.

tagSchemes: An array of tag schemes. See NSLinguisticTagScheme for the possible values.
options: Reserved for future use. Specify 0 for this parameter.

NSLinguisticTaggerMBS.orthographyAtIndex(charIndex as integer, byref effectiveRange as NSRangeMBS) as NSOrthographyMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the orthography at the index and also returns the effective range.
Example
dim TagScheme as string = NSLinguisticTaggerMBS.NSLinguisticTagSchemeLanguage
dim TagSchemes() as string = array(TagScheme)
dim t as new NSLinguisticTaggerMBS(TagSchemes)

t.Text = "Hallo Leute"

dim tokenRange as NSRangeMBS
dim sentenceRange as NSRangeMBS
dim tag as string = t.tagAtIndex(0, TagScheme, tokenRange, sentenceRange)

dim effectiveRange as NSRangeMBS
dim o as NSOrthographyMBS = t.orthographyAtIndex(0, effectiveRange)

MsgBox o.dominantLanguage+" "+o.dominantScript

charIndex: The character index to begin examination.
effectiveRange: An NSRangeMBS that, upon completion, contains the range of the orthography containing charIndex.

Returns the orthography for the location.

NSLinguisticTaggerMBS.sentenceRangeForRange(range as NSRangeMBS) as NSRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the range of a sentence containing the specified range.

charRange: The character range.

Returns the range of the sentence.

This is a convenience method for calling tokenRangeAtIndex, passing the NSLinguisticTaggerUnitSentence unit and the first position of the provided range.

NSLinguisticTaggerMBS.setOrthography(orthography as NSOrthographyMBS, range as NSRangeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the orthography for the specified range.

orthography: The orthography.
charRange: The range.

If the orthography of the linguistic tagger is not set, it will determine it automatically from the contents of the text. You should call this method only if you know the orthography of the text by some other means.

NSLinguisticTaggerMBS.tagAtIndex(charIndex as Integer, Scheme as String, byref tokenRange as NSRangeMBS, byref sentenceRange as NSRangeMBS) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a tag for a single scheme at the specified character position.

charIndex: The position of the initial character.
tagScheme: The tag scheme. See NSLinguisticTagScheme for the possible values.
tokenRange: The token range for output.
sentenceRange: The range of the sentence for output.

Returns the tag for the requested tag scheme, or nil. If a tag is returned, this function returns by reference the range of the token to tokenRange, and the range of the enclosing sentence to sentenceRange, if applicable.

This is a convenience method for calling tagAtIndex and passing NSLinguisticTaggerUnitWord as the linguistic unit.

Available in macOS 10.7 and newer.

See also:

NSLinguisticTaggerMBS.tagAtIndex(charIndex as Integer, unit as Integer, Scheme as String, byref tokenRange as NSRangeMBS) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a tag for a single scheme for a given linguistic unit at the specified character position.

charIndex: The position of the initial character.
unit: The linguistic unit. See NSLinguisticTaggerUnit for possible values.
tagScheme: The tag scheme. See NSLinguisticTagScheme for possible values.
tokenRange: The token range for output.

Returns the tag for the requested tag scheme and linguistic unit, or nil. If a tag is returned, this function returns by reference the range of the token to tokenRange.

Available in macOS 10.13 and newer.

See also:

NSLinguisticTaggerMBS.tagSchemes as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the tag schemes configured for this linguistic tagger.

For possible values, see NSLinguisticTagScheme.

Some examples using this method:

NSLinguisticTaggerMBS.tagsInRange(range as NSRangeMBS, Scheme as String, options as Integer) as NSLinguisticValueMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of linguistic tags and token ranges.

range: The range to analyze.
tagScheme: The tag scheme. For possible values, see NSLinguisticTagScheme.
options: The linguistic tagger options to use. See NSLinguisticTaggerOptions for possible values.

Available in macOS 10.7 and newer.

See also:

Some examples using this method:

NSLinguisticTaggerMBS.tagsInRange(range as NSRangeMBS, unit as Integer, Scheme as String, options as Integer) as NSLinguisticValueMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of linguistic tags and token ranges.

range: The range to analyze.
unit: The linguistic unit. For possible values, see NSLinguisticTaggerUnit.
tagScheme: The tag scheme. For possible values, see NSLinguisticTagScheme.
options: The linguistic tagger options to use. See NSLinguisticTaggerOptions for possible values.

Available in macOS 10.13 and newer.

Returns all tokens intersecting a given range, supplying tags and ranges. The tagger segments the string into sentences and tokens as necessary, and return those ranges along with a tag for any scheme in its array of tag schemes. For example, if the tag scheme is NSLinguisticTagSchemeLexicalClass, the tags specify the part of speech (for word tokens) or the type of whitespace or punctuation (for whitespace or punctuation tokens). If the tag scheme is NSLinguisticTagSchemeLemma, the tags specify the stem form of the word (if known) for each word token.

See also:

NSLinguisticTaggerMBS.tokenRangeAtIndex(charIndex as Integer, Unit as Integer) as NSRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Linguistic MBS MacCocoa Plugin 17.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the range of the linguistic unit containing the specified character index.

charIndex: The character index to begin examination.
unit: The linguistic unit. For possible values, see NSLinguisticTaggerUnit.

Returns the range of the substring for the linguistic unit.
Available in macOS 10.13 and newer.

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


The biggest plugin in space...