Skip to content

Latest commit

 

History

History

identify-languages

@react-native-ml-kit/identify-languages

React Native On-Device Language Identification w/ Google ML Kit

Getting started

npm install @react-native-ml-kit/identify-languages --save

Linking

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

Installing Pods

On iOS, use CocoaPods to add the native RNMLKitIdentifyLanguages to your project:

npx pod-install

Usage

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" }]