React Native On-Device Language Identification w/ Google ML Kit
React Native On-Device Language Identification w/ Google ML Kit
npm install @react-native-ml-kit/identify-languages --save
#### React Native > 0.59
CLI autolink feature links the module while building the app.
#### React Native <= 0.59
react-native link @react-native-ml-kit/identify-languages
On iOS, use CocoaPods to add the native RNMLKitIdentifyLanguages to your project:
npx pod-install
``javascript
import IdentifyLanguages from '@react-native-ml-kit/identify-languages';
const lang = await IdentifyLanguages.identify('Ciao'); // "it" (Italian)
const possibleLangs = await IdentifyLanguages.identifyPossible('Ciao'); // [{ "language": "it", "confidence": 0.9789841771125793 }, { "confidence": 0.012451663613319397, "language": "zh-Latn" }]
``