flutter_langdetect 0.0.2 copy "flutter_langdetect: ^0.0.2" to clipboard
flutter_langdetect: ^0.0.2 copied to clipboard

A Flutter package for detecting the language of a given text using character-wise n-gram models

example/main.dart

import 'package:flutter_langdetect/flutter_langdetect.dart' as langdetect;

void main() async {
  // `ensureInitialized` is needed once in your application when you use this library in the actual application.
  // WidgetsFlutterBinding.ensureInitialized();

  // Then, call `initLangDetect` once.
  await langdetect.initLangDetect();

  String text = 'Hello, world!';
  final language = langdetect.detect(text);
  print('Detected language: $language'); // -> "en"

  print('\n');

  final probs = langdetect.detectLangs(text);
  for (final p in probs) {
    print("Language: ${p.lang}");
    print("Probability: ${p.prob}");
  }
}
12
likes
120
points
790
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for detecting the language of a given text using character-wise n-gram models

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, logger

More

Packages that depend on flutter_langdetect