Class: NSLinguisticTagger
Overview
The NSLinguisticTagger class is used to automatically segment natural-language text and tag it with information, such as parts of speech. It can also tag languages, scripts, stem forms of words, etc. An instance of this class is assigned a string to tag, and clients can then obtain tags and ranges for tokens in that string appropriate to a given tag scheme.
Class Method Summary (collapse)
-
+ availableTagSchemesForLanguage:
Returns the tag schemes supported by the linguistic tagger for a particular language.
Instance Method Summary (collapse)
-
- enumerateTagsInRange:scheme:options:usingBlock:
Enumerates the specific range of the string, providing the Block with the located tags.
-
- initWithTagSchemes:options:
Creates a linguistic tagger instance using the specified tag schemes and options.
-
- orthographyAtIndex:effectiveRange:
Returns the orthography at the index and also returns the effective range.
-
- possibleTagsAtIndex:scheme:tokenRange:sentenceRange:scores:
Returns an array of possible tags for the given scheme at the specified range, supplying matching scores.
-
- sentenceRangeForRange:
Returns the range of a sentence boundary containing the specified range.
-
- setOrthography:range:
Sets the orthography for the specified range.
-
- setString:
Sets the string to be analyzed by the linguistic tagger.
-
- string
Returns the string being analyzed by the linguistic tagger.
-
- stringEditedInRange:changeInLength:
Notifies the linguistic tagger that the string (if mutable) has changed as specified by the parameters.
-
- tagAtIndex:scheme:tokenRange:sentenceRange:
Returns a tag for a single scheme at the specified index.
-
- tagSchemes
Returns the tag schemes supported by the linguistic tagger for a particular language.
-
- tagsInRange:scheme:options:tokenRanges:
Returns an array of linguistic tags and token ranges.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (Array) availableTagSchemesForLanguage(language)
Returns the tag schemes supported by the linguistic tagger for a particular language. Clients wishing to know the tag schemes supported for a NSLinguisticTagger instance for a particular language may query them with this method. The language should be specified using a standard abbreviation as with NSOrthography.
Instance Method Details
- (Object) enumerateTagsInRange(range, scheme:tagScheme, options:opts, usingBlock:block)
Enumerates the specific range of the string, providing the Block with the located tags. The tagger will segment the string as needed into sentences and tokens, and return those ranges along with a tag for any scheme in its array of tag schemes. This is the fundamental tagging method of NSLinguisticTagger. This method’s block iterates over all tokens intersecting a given range, supplying tags and ranges. There are several additional convenience methods, for obtaining a sentence range, information about a single token, or information about all tokens intersecting a given range at once.For example, if the tag scheme is NSLinguisticTagSchemeLexicalClass, the tags will 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 will specify the stem form of the word (if known) for each word token.It is important to note that this method will return the ranges of all tokens that intersect the given range.
- (Object) initWithTagSchemes(tagSchemes, options:opts)
Creates a linguistic tagger instance using the specified tag schemes and options.
- (NSOrthography) orthographyAtIndex(charIndex, effectiveRange:effectiveRange)
Returns the orthography at the index and also returns the effective range.
- (Array) possibleTagsAtIndex(charIndex, scheme:tagScheme, tokenRange:tokenRange, sentenceRange:sentenceRange, scores:scores)
Returns an array of possible tags for the given scheme at the specified range, supplying matching scores.
- (NSRange) sentenceRangeForRange(charRange)
Returns the range of a sentence boundary containing the specified range. This method can be used to obtain the enclosing sentence range given a token range.
- (Object) setOrthography(orthography, range:charRange)
Sets the orthography for the specified range. If the orthography of the linguistic tagger is not set, it will determine it automatically from the contents of the text. Clients should call this method only if they already know the language of the text by some other means.
- (Object) setString(string)
Sets the string to be analyzed by the linguistic tagger.
- (String) string
Returns the string being analyzed by the linguistic tagger.
- (Object) stringEditedInRange(newCharRange, changeInLength:delta)
Notifies the linguistic tagger that the string (if mutable) has changed as specified by the parameters.
- (String) tagAtIndex(charIndex, scheme:tagScheme, tokenRange:tokenRange, sentenceRange:sentenceRange)
Returns a tag for a single scheme at the specified index. When the returned array contains entries that do not have a corresponding tagScheme, that entry is an instance of NSNull.
- (Array) tagSchemes
Returns the tag schemes supported by the linguistic tagger for a particular language.
- (Array) tagsInRange(range, scheme:tagScheme, options:opts, tokenRanges:tokenRanges)
Returns an array of linguistic tags and token ranges.