a7medev / react-native-ml-kit

React Native On-Device Machine Learning w/ Google ML Kit
MIT License
396 stars 58 forks source link

Non-latin text-recognition support #28

Closed spetrey closed 1 year ago

spetrey commented 1 year ago

Closes #27

What does this PR do?

This PR adds official text-recognition support for:

GoogleMLKit/TextRecognitionChinese
GoogleMLKit/TextRecognitionDevanagari
GoogleMLKit/TextRecognitionJapanese
GoogleMLKit/TextRecognitionKorean

How to use

const result = await TextRecognition.recognize(imagePath) // Latin text-recognition
...
const result = await TextRecognition.recognize(imagePath, 'Chinese') // Chinese text-recognition
...
const result = await TextRecognition.recognize(imagePath, 'Devanagari') // Devanagari text-recognition
...
const result = await TextRecognition.recognize(imagePath, 'Japanese') // Japanese text-recognition
...
const result = await TextRecognition.recognize(imagePath, 'Korean') // Korean text-recognition

Results:

Japanese and Devanagari

Screenshot 2023-04-04 at 7 36 41 PM

Chinese

Screenshot 2023-04-04 at 7 34 38 PM

Korean

Screenshot 2023-04-04 at 7 33 41 PM

This is my first PR here! I will be the first to admit that Objective-C is not my strongest language, so I welcome any and all feedback! I would love for someone to pull this branch down and take it for a spin. My initial testing yielded some good results but would love someone to double-check my work and give me a sanity check πŸ˜„

spetrey commented 1 year ago

@a7medev great feedback on the PR! Much appreciated. I addressed your comments and went a little further to do some additional cleanup. I also figured I would rename the language param to script here because it's based on Script names instead of Language names. See this table from ML Kit's text recognition v2 docs:

https://developers.google.com/ml-kit/vision/text-recognition/v2/languages#supported-langs

Let me know if you see anything else that needs addressing :)

spetrey commented 1 year ago

Thanks for the last bit of feedback on changes @a7medev πŸ™

a7medev commented 1 year ago

@spetrey I think will also need to support for Android as well to keep both platforms consistent. What do you think?

spetrey commented 1 year ago

@a7medev apologies on the delay getting back to you. I do agree that supporting Android is important. Unfortunately, I have never worked on any Java projects before this, so I may be unable to contribute to supporting Android on this PR (in the short-term) 😞

What're your thoughts on merging this PR, then creating an Issue to track adding support for TextRecognition on Android at a later date?

a7medev commented 1 year ago

@spetrey Sounds good. Thanks for your contribution! πŸ™ I'll test this PR on iOS and merge it and will work on another PR for Android.

spetrey commented 1 year ago

Thank you for taking the time to review! Let me know if you encounter any issues testing @a7medev, happy to resolve anything that comes up πŸ‘

spetrey commented 1 year ago

Happy to contribute friend. Also, thanks for the feedback on this PR @a7medev! Appreciate you double-checking my contribution and ensuring backward compat on Android as well πŸ™

cardanoeconews commented 1 year ago

Hi @a7medev and @spetrey , Just checking in to see if Android support for non-latin has been added or if you've started on that MR @a7medev ? It's something needed before I can ship my product as there are a ton of android users in South Korea. Would love any help, happy to sponsor!

a7medev commented 1 year ago

Hi @cardanoeconews! Unfortunately, I haven't had much time to work on adding Android support lately, will work on it once I have some time. πŸ™πŸΌ Happy to know you are using it in production!

I don't have GitHub Sponsors set up at the moment, but I'm working on itβ€”having some support would actually allow me to spend more time working on these projects and delivering more features.

a7medev commented 1 year ago

Wow, that was fast! πŸ˜… I've set up GitHub Sponsors, you can sponsor my work on React Native ML Kit and other packages through my Sponsors page!

a7medev commented 1 year ago

Quick update! Non-Latin script Android support just landed in @react-native-ml-kit/text-recognition v1.5.0 πŸš€