Skip to content
This repository was archived by the owner on May 28, 2026. It is now read-only.

Commit d4e746f

Browse files
vm-pranavanDumbledore
authored andcommitted
Add Northern Min (mnp) language to Google Cloud Vision engine
Use documentTextDetection instead of textDetection for better recognition of complex diacritic characters used in mnp. Bug: T383002
1 parent 70ea70a commit d4e746f

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

public/models.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,10 @@
548548
"languages": ["mn"],
549549
"title": "Монгол / Mongolian / Cyrl / Supports handwriting"
550550
},
551+
"mnp": {
552+
"languages": ["mnp"],
553+
"title": "Mìng-dĕ̤ng-ngỳ̄ / Northern Min / Latn / Supports handwriting"
554+
},
551555
"moh": {
552556
"languages": ["moh"],
553557
"title": "Kanienʼkéha / Mohawk / Latn / Mapped / Supports handwriting"

src/Engine/GoogleCloudVisionEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getResult(
6868

6969
$image = $this->getImage( $imageUrl, $crop );
7070
$imageUrlOrData = $image->hasData() ? $image->getData() : $image->getUrl();
71-
$response = $this->imageAnnotator->textDetection( $imageUrlOrData, [ 'imageContext' => $imageContext ] );
71+
$response = $this->imageAnnotator->documentTextDetection( $imageUrlOrData, [ 'imageContext' => $imageContext ] );
7272

7373
// Re-try with direct upload if the error returned is something similar to
7474
// "The URL does not appear to be accessible by us. Please double check or download the content and pass it in."
@@ -78,7 +78,7 @@ public function getResult(
7878
&& stripos( $response->getError()->getMessage(), 'download the content and pass it in' ) !== false
7979
) {
8080
$image = $this->getImage( $imageUrl, $crop, self::DO_DOWNLOAD_IMAGE );
81-
$response = $this->imageAnnotator->textDetection( $image->getData(), [ 'imageContext' => $imageContext ] );
81+
$response = $this->imageAnnotator->documentTextDetection( $image->getData(), [ 'imageContext' => $imageContext ] );
8282
}
8383

8484
// Other errors, report to the user.

0 commit comments

Comments
 (0)