LanguageDetector constructor

LanguageDetector({
  1. required LanguageDetectorBackend backend,
  2. double minConfidence = 0.5,
  3. Set<String>? restrictTo,
})

Creates a detector scoring with backend.

restrictTo, when non-null, is applied as a post-hoc filter over backend's results: guesses whose code is not in restrictTo are dropped before ranking. This works for any backend, but does not improve a custom backend's internal accuracy — only pureDart threads restrictTo into the scoring stage itself, which is what actually sharpens n-gram accuracy.

Implementation

LanguageDetector({
  required this.backend,
  this.minConfidence = 0.5,
  this.restrictTo,
});