VNRecognizeTextRequest doesn't recognize Dansk language "da-DK"

527 views Asked by At

VNRecognizeTextRequest doesn't recognize special characters of Dansk language like Æ, æ, Ø, ø, Å ,å ,ß

It replace these words with Æ to AE, Ø to 0,O, Å to A and so on.

Below is my code for OCR Implementation.

private func configureOCR() {
    
    ocrRequest.recognitionLevel = .accurate
  
    ocrRequest.recognitionLanguages = ["da-DK", "nl-NL", "de-DE", "en-US","en-AU"]
    ocrRequest.usesLanguageCorrection = true
    
    ocrRequest = VNRecognizeTextRequest { (request, error) in
        guard let observations = request.results as? [VNRecognizedTextObservation] else { return }
        
        var ocrText = ""
        for observation in observations {
            guard let topCandidate = observation.topCandidates(1).first else { return }
            
            ocrText += topCandidate.string + "\n"
        }
        
        
        DispatchQueue.main.async {
            self.ocrTextView.text = ocrText
            self.scanButton.isEnabled = true
        }
    }
    
}

Does vision or vision kit support Dansk language?

1

There are 1 answers

0
Breno Valadão On

I don't think so. If you look at the documentation

 @brief VNRecognizeTextRequestRevision1 only supports English

 @brief VNRecognizeTextRequestRevision2 supports English, Chinese, 
Portuguese, French, Italian, German and Spanish in the accurate 
recognition level. The fast recognition level supports English,
 Portuguese, French, Italian, German and Spanish. Best practice 
is to use supportedRecognitionLanguagesForTextRecognitionLevel 
to check for supported languages. As the underlying engine has 
changed from VNRecognizeTextRequestRevision1, results can differ 
but are generally more accurate.