LanguageDetector
final class LanguageDetectorIdentifies the language of input text using a MediaPipe TensorFlow Lite model.
-
Initializes a detector from an on-disk
.tflitemodel file using default filtering options.Declaration
Swift
convenience init(modelPath: String) throwsParameters
modelPathFile-system path to the TensorFlow Lite model asset.
-
Initializes the underlying MediaPipe task graph using
options.Declaration
Swift
init(options: LanguageDetectorOptions) throwsParameters
optionsModel asset and prediction-filtering settings.
-
Infers the most likely languages for
text.Declaration
Swift
final func detect(text: String) throws -> LanguageDetectorResultParameters
textUTF-8 text to analyze.
Return Value
Ranked language predictions matching the configured thresholds and filters.