I am tinkering with the NSLinguisticTagger.
Identifying basic word types like noun, verb, prepositions works really well.
However the recognition of person names NSLinguisticTagPersonalName hardly works in my tests (iOS8). Places NSLinguisticTagPlaceName also seem to work pretty well, however most of the times also person names are categorised as places.
Here's my basic setup (using NSLinguisticTagSchemeNameTypeOrLexicalClass)
var tagger:NSLinguisticTagger = NSLinguisticTagger(tagSchemes: NSLinguisticTagger.availableTagSchemesForLanguage("en") , options: 3)
tagger.string = entryString
tagger.enumerateTagsInRange(NSMakeRange(0, entryString.length), scheme: NSLinguisticTagSchemeNameTypeOrLexicalClass, options: (NSLinguisticTaggerOptions.OmitWhitespace | NSLinguisticTaggerOptions.JoinNames), usingBlock: {
tag,tokenRange,sentenceRange,_ in
let token = entryString.substringWithRange(tokenRange)
println("[\(tag)] \(token) \(tokenRange)")
Example 1
"Meeting with John in Paris"
Evaluation
[Verb] Meeting
[Preposition] with
[Noun] John
[Preposition] in
[PlaceName] Paris
Example 2
"Meeting with John"
Evaluation
[Verb] Meeting (0,7)
[Preposition] with (8,4)
[PlaceName] John (13,4)
Any idea how I could improve the matching for person names?
Also I'd be interested to know how a Name would need to appear to be recognized. (I assumed e.g. a preposition like "with" would be a good indicator … apparently this isn't enough). I'd appreciate any ideas or additional insights on this. It's an exciting field.