クラスを使用しNSLinguisticTagger
ていますが、デンマーク語でテストしたいと思います。
NSString *textToAnalyse = @"Her skal du finde det tal, som mangler";
完全に解析したいので、この範囲には文字列全体が含まれます。
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`
見つかりません...
NSArray *language = [NSArray arrayWithObject:@"da"];
NSDictionary* languageMap = [NSDictionary dictionaryWithObject:language forKey:@"Latn"];
...デンマーク語の場合。誰かがそれを使用したか、何かアイデアがあれば教えてください。