This is a .NET wrapper for the MediaPipe library by Google AI Edge. This package facilitates the integration of language identification capabilities into .NET applications, leveraging the powerful and efficient MediaPipe library to recognize and classify texts in multiple languages. Ideal for applications that require fast and accurate language detection.
$ dotnet add package Panlingo.LanguageIdentification.MediaPipeWelcome to Panlingo.LanguageIdentification.MediaPipe, a .NET wrapper for the MediaPipe library by Google Inc. This package seamlessly integrates language identification capabilities into .NET applications, enabling accurate and efficient recognition of over 107 languages with minimal effort. Perfect for applications dealing with multilingual texts or requiring automatic language detection.
| OS / Arch | x86_64 | arm64 |
|---|---|---|
| Linux | :white_check_mark: | :white_check_mark: |
| Windows | :white_check_mark: | :x: |
| macOS | :x: | :white_check_mark: |
:white_check_mark: — Full support | :x: — No support | :construction: — Under research
To integrate the MediaPipe functionality, follow these steps:
Install the NuGet package:
dotnet add package Panlingo.LanguageIdentification.MediaPipe
Integrating the MediaPipe library into your .NET application is straightforward. Here’s a quick guide to get you started:
Panlingo.LanguageIdentification.MediaPipe package to your project using the provided installation command.using Panlingo.LanguageIdentification.MediaPipe;
class Program
{
static void Main()
{
using var mediaPipe = new MediaPipeDetector(
options: MediaPipeOptions.FromDefault()
);
var text = "Привіт, як справи?";
var predictions = mediaPipe.PredictLanguages(text);
foreach (var prediction in predictions)
{
Console.WriteLine(
$"Language: {prediction.Language}, " +
$"Probability: {prediction.Probability}"
);
}
}
}
Download the pretrained language identification (LID) model provided by Google:
curl --location -o /models/mediapipe_language_detector.tflite https://storage.googleapis.com/mediapipe-models/language_detector/language_detector/float32/1/language_detector.tflite
Learn more about this model here:
You can use the model included in this NuGet package:
using var mediaPipe = new MediaPipeDetector(
options: MediaPipeOptions.FromDefault()
);
You can specify the path to the model file:
var modelPath = "/models/mediapipe_language_detector.tflite";
using var mediaPipe = new MediaPipeDetector(
options: MediaPipeOptions.FromFile(modelPath)
);
Also you can also load the model as a memory stream:
var modelPath = "/models/mediapipe_language_detector.tflite";
using var stream = File.Open(modelPath, FileMode.Open);
using var mediaPipe = new MediaPipeDetector(
options: MediaPipeOptions.FromStream(stream)
);
This project is licensed under the MIT License © 2024–2025 Alexander Gluschenko.
Includes software from the following project(s):
See the LICENSE file for full details.
We value your feedback. Feel free to open issues or contribute to the repository. Let’s make language detection in .NET even more powerful and versatile! 🌍📝
Happy coding! 👩💻👨💻