NSLinguisticTagger does not return evaluation scores
| Originator: | o.j.mason | ||
| Number: | rdar://14844488 | Date Originated: | 27/08/2013 |
| Status: | Closed | Resolved: | Works as expected in OS X 10.9 |
| Product: | OS X SDK | Product Version: | 10.7.5 |
| Classification: | Other bug | Reproducible: | always |
27-Aug-2013 03:04 PM Oliver Mason:
Summary:
The "possibleTagsAtIndex" method of the NSLinguisticTagger class does not return scores.
Steps to Reproduce:
Execute the attached code. This takes a single (English) sentence, analyses it, and logs the results.
Expected Results:
Apart from the list of possible tags, a list containing the respective likelihood scores should also be returned.
2013-08-27 14:42:15.281 NLPlayground[29985:303] train: Noun
2013-08-27 14:42:15.282 NLPlayground[29985:303] poss: (
Noun,
Verb
); scores: (**HERE SHOULD BE TWO NSVALUE OBJECTS CONTAINING SCORES**)
Actual Results:
2013-08-27 14:42:15.281 NLPlayground[29985:303] train: Noun
2013-08-27 14:42:15.282 NLPlayground[29985:303] poss: (
Noun,
Verb
); scores: (null)
Regression:
This issue does not seem to affect tagging performance.
Notes:
The salient parts of the source code are:
NSString *question = @"When is the next train to Aberystwyth?";
NSLinguisticTaggerOptions options = NSLinguisticTaggerOmitWhitespace | NSLinguisticTaggerOmitPunctuation | NSLinguisticTaggerJoinNames;
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc] initWithTagSchemes: [NSLinguisticTagger availableTagSchemesForLanguage:@"en"] options:options];
tagger.string = question;
[tagger enumerateTagsInRange:NSMakeRange(0, [question length]) scheme:NSLinguisticTagSchemeNameTypeOrLexicalClass options:options usingBlock:^(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop) {
NSString *token = [question substringWithRange:tokenRange];
NSLog(@"%@: %@", token, tag);
NSArray *scores = nil;
NSArray *poss = [tagger possibleTagsAtIndex:tokenRange.location scheme:NSLinguisticTagSchemeLexicalClass tokenRange:&tokenRange sentenceRange:&sentenceRange scores:&scores];
NSLog(@"poss: %@; scores: %@",poss,scores);
}];
The final three lines (starting from the NSArray *scores declaration) are the relevant parts.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!