I am using NSLinguisticTagger
class and I want to test it for Danish language:
NSString *textToAnalyse = @"Her skal du finde det tal, som mangler";
This range contains the entire string, since we want to parse it completely:
NSRange stringRange = NSMakeRange(0, textToAnalyse.length);
// Dictionary with a language map
//NSArray *language = [NSArray arrayWithObjects:@"en",@"de",@"fr",nil];
NSArray *language = [NSArray arrayWithObject:@"da"];
NSDictionary* languageMap = [NSDictionary dictionaryWithObject:language forKey:@"Latn"];
[textToAnalyse enumerateLinguisticTagsInRange:stringRange
scheme:NSLinguisticTagSchemeLexicalClass
options:0
orthography:[NSOrthography orthographyWithDominantScript:@"Latn" languageMap:languageMap]
usingBlock:^(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop) {
// NSLog(@"%@ is a %@, tokenRange (%d,%d), sentenceRange (%d,%d)",[textToAnalyse substringWithRange:tokenRange] ,tag,tokenRange.length,tokenRange.location, sentenceRange.length, sentenceRange.location);
NSLog(@"%@ is a %@",[textToAnalyse substringWithRange:tokenRange] ,tag);
}]; ...`enter code here`
I am unable to find...
NSArray *language = [NSArray arrayWithObject:@"da"];
NSDictionary* languageMap = [NSDictionary dictionaryWithObject:language forKey:@"Latn"];
...for Danish. Please tell me if anyone has used it or has any ideas.