I'm currently doing work with people using speech recognition and detecting names in speech. This works well however I'm having issues with names. I'm in Wales and many people around have Welsh names (including me). I have a CSV of all the Welsh Names. Some names are also being picked up as Places (like Osian) Is there a way to extend the NSLinguisticTagger to include Welsh Names? Or is there a way of detecting the Welsh name?
Here is my current code:
let text = "Hey I'm Osian"
// 2
let tagger = NLTagger(tagSchemes: [.nameType])
tagger.string = text
let options: NLTagger.Options = [.omitPunctuation, .omitWhitespace, .joinNames]
let tags: [NLTag] = [.personalName, .organizationName, .placeName]
// 3
tagger.enumerateTags(in: text.startIndex..<text.endIndex, unit: .word, scheme: .nameType, options: options) { tag, tokenRange in
if let tag = tag, tags.contains(tag) {
print("\(text[tokenRange]): \(tag.rawValue)")
}
return true
}