KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just started playing around with NSLinguisticTagger basing my code on this blog: NSLinguisticTagger @ NSHipster.com 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); }]; When I run this with question = @"Weekend in New York" , "New York" gets tagged as PlaceName which is great. But when I run this with question = @"Weekend in new york" , "new" gets tagged as "Adjective" and "york" gets tagged as PlaceName . Is there any way to get around this such that "New York" and "new york" both get tagged as PlaceName ? I'm totally new to this linguistics thing.
Tags (comma-separated)
Save Edits
Cancel