Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit e7a9695

Browse files
committed
feat: Add confidence score for Android
This was released on the 18.0.1: https://developers.google.com/ml-kit/release-notes?hl=en#august_16_2022 It does not seem to exist on iOS for now
1 parent 4060f93 commit e7a9695

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,6 @@ dependencies {
127127
// noinspection GradleDynamicVersion
128128
api 'com.facebook.react:react-native:+'
129129
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
130-
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.0'
130+
implementation 'com.google.android.gms:play-services-mlkit-text-recognition:18.0.2'
131131

132132
}

android/src/main/java/com/reactnativemlkitocr/MlkitOcrModule.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class MlkitOcrModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
8888
e.putString("text", element.text)
8989
e.putMap("bounding", getCoordinates(element.boundingBox))
9090
e.putArray("cornerPoints", getCornerPoints(element.cornerPoints))
91+
e.putString("confidence", element.confidence.toString())
9192
lineElements.pushMap(e)
9293
}
9394
val l: WritableMap = Arguments.createMap()
@@ -96,6 +97,7 @@ class MlkitOcrModule(reactContext: ReactApplicationContext) : ReactContextBaseJa
9697
l.putMap("bounding", lCoordinates)
9798
l.putArray("elements", lineElements)
9899
l.putArray("cornerPoints", getCornerPoints(line.cornerPoints))
100+
l.putString("confidence", line.confidence.toString())
99101

100102
blockElements.pushMap(l)
101103
}

0 commit comments

Comments
 (0)