2

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.

Chris Barlow
  • 3,274
  • 4
  • 31
  • 52

1 Answers1

1

It doesn't exist. For iOS there is currently only support for English, due to space constraints.

Oliver Mason
  • 2,240
  • 2
  • 15
  • 23
  • Not only English, but also French, and German, see: http://nathanmock.com/files/com.apple.adc.documentation.AppleiOS6.0.iOSLibrary.docset/Contents/Resources/Documents/#releasenotes/Foundation/RN-Foundation-iOS/Foundation_iOS5.html – kelin Jun 26 '15 at 09:51
  • The document year is 2011 :) – kelin Jul 08 '15 at 09:18