Panlingo.LanguageIdentification.Lingua.Native
0.3.0
dotnet add package Panlingo.LanguageIdentification.Lingua.Native --version 0.3.0
NuGet\Install-Package Panlingo.LanguageIdentification.Lingua.Native -Version 0.3.0
<PackageReference Include="Panlingo.LanguageIdentification.Lingua.Native" Version="0.3.0" />
paket add Panlingo.LanguageIdentification.Lingua.Native --version 0.3.0
#r "nuget: Panlingo.LanguageIdentification.Lingua.Native, 0.3.0"
// Install Panlingo.LanguageIdentification.Lingua.Native as a Cake Addin #addin nuget:?package=Panlingo.LanguageIdentification.Lingua.Native&version=0.3.0 // Install Panlingo.LanguageIdentification.Lingua.Native as a Cake Tool #tool nuget:?package=Panlingo.LanguageIdentification.Lingua.Native&version=0.3.0
Panlingo.LanguageIdentification.Lingua
Welcome to Panlingo.LanguageIdentification.Lingua, a .NET wrapper for the Lingua library, which is an efficient and easy-to-use language detection library. This package simplifies the integration of language identification capabilities into .NET applications, leveraging the Lingua library to accurately and quickly recognize the languages of given texts. Perfect for projects that require lightweight yet reliable language detection.
Requirements
- Runtime: .NET >= 5.0
- OS: Linux (Ubuntu, Debian), Windows 10+ or Windows Server 2019+, macOS
- Arch: AMD64 (or ARM for macOS)
Installation
To integrate the Lingua functionality, follow these steps:
Install the NuGet package:
dotnet add package Panlingo.LanguageIdentification.Lingua
Usage
Integrating the Lingua library into your .NET application is straightforward. Here’s a quick guide to get you started:
- Install the Package: Ensure you have added the
Panlingo.LanguageIdentification.Lingua
package to your project using the provided installation command. - Initialize the Library: Follow the example snippet to initialize and use the Lingua library for detecting languages.
using Panlingo.LanguageIdentification.Lingua;
class Program
{
static void Main()
{
// Create an instance of the language detector
using var linguaBuilder = new LinguaDetectorBuilder(Enum.GetValues<LinguaLanguage>())
.WithPreloadedLanguageModels() // optional
.WithMinimumRelativeDistance(0.95) // optional
.WithLowAccuracyMode(); // optional
using var lingua = linguaBuilder.Build();
var texts = new[]
{
"Hello, how are you?",
"Привіт, як справи?",
"Привет, как дела?",
};
var predictions = texts
.Select(x => new
{
Text = x,
Predictions = lingua.PredictLanguages(x),
})
.ToArray();
foreach (var x in predictions)
{
var prediction = x.Predictions.FirstOrDefault();
Console.WriteLine(
$"Text: {x.Text}, " +
$"Language: {prediction?.Language.ToString() ?? "NULL"}, " +
$"Probability: {prediction?.Confidence.ToString() ?? "NULL"}"
);
}
}
}
Alternatives
If you are exploring other options, here are some alternatives to consider:
- searchpioneer/lingua-dotnet: An alternative port for .NET.
Sources
Supported languages
Language | ISO 639-3 | Enum |
---|---|---|
Afrikaans | afr | LinguaLanguage.Afrikaans |
Albanian | sqi | LinguaLanguage.Albanian |
Arabic | ara | LinguaLanguage.Arabic |
Armenian | hye | LinguaLanguage.Armenian |
Azerbaijani | aze | LinguaLanguage.Azerbaijani |
Basque | eus | LinguaLanguage.Basque |
Belarusian | bel | LinguaLanguage.Belarusian |
Bengali | ben | LinguaLanguage.Bengali |
Bokmal | nob | LinguaLanguage.Bokmal |
Bosnian | bos | LinguaLanguage.Bosnian |
Bulgarian | bul | LinguaLanguage.Bulgarian |
Catalan | cat | LinguaLanguage.Catalan |
Chinese | zho | LinguaLanguage.Chinese |
Croatian | hrv | LinguaLanguage.Croatian |
Czech | ces | LinguaLanguage.Czech |
Danish | dan | LinguaLanguage.Danish |
Dutch | nld | LinguaLanguage.Dutch |
English | eng | LinguaLanguage.English |
Esperanto | epo | LinguaLanguage.Esperanto |
Estonian | est | LinguaLanguage.Estonian |
Finnish | fin | LinguaLanguage.Finnish |
French | fra | LinguaLanguage.French |
Ganda | lug | LinguaLanguage.Ganda |
Georgian | kat | LinguaLanguage.Georgian |
German | deu | LinguaLanguage.German |
Greek | ell | LinguaLanguage.Greek |
Gujarati | guj | LinguaLanguage.Gujarati |
Hebrew | heb | LinguaLanguage.Hebrew |
Hindi | hin | LinguaLanguage.Hindi |
Hungarian | hun | LinguaLanguage.Hungarian |
Icelandic | isl | LinguaLanguage.Icelandic |
Indonesian | ind | LinguaLanguage.Indonesian |
Irish | gle | LinguaLanguage.Irish |
Italian | ita | LinguaLanguage.Italian |
Japanese | jpn | LinguaLanguage.Japanese |
Kazakh | kaz | LinguaLanguage.Kazakh |
Korean | kor | LinguaLanguage.Korean |
Latin | lat | LinguaLanguage.Latin |
Latvian | lav | LinguaLanguage.Latvian |
Lithuanian | lit | LinguaLanguage.Lithuanian |
Macedonian | mkd | LinguaLanguage.Macedonian |
Malay | msa | LinguaLanguage.Malay |
Maori | mri | LinguaLanguage.Maori |
Marathi | mar | LinguaLanguage.Marathi |
Mongolian | mon | LinguaLanguage.Mongolian |
Nynorsk | nno | LinguaLanguage.Nynorsk |
Persian | fas | LinguaLanguage.Persian |
Polish | pol | LinguaLanguage.Polish |
Portuguese | por | LinguaLanguage.Portuguese |
Punjabi | pan | LinguaLanguage.Punjabi |
Romanian | ron | LinguaLanguage.Romanian |
Russian | rus | LinguaLanguage.Russian |
Serbian | srp | LinguaLanguage.Serbian |
Shona | sna | LinguaLanguage.Shona |
Slovak | slk | LinguaLanguage.Slovak |
Slovene | slv | LinguaLanguage.Slovene |
Somali | som | LinguaLanguage.Somali |
Sotho | sot | LinguaLanguage.Sotho |
Spanish | spa | LinguaLanguage.Spanish |
Swahili | swa | LinguaLanguage.Swahili |
Swedish | swe | LinguaLanguage.Swedish |
Tagalog | tgl | LinguaLanguage.Tagalog |
Tamil | tam | LinguaLanguage.Tamil |
Telugu | tel | LinguaLanguage.Telugu |
Thai | tha | LinguaLanguage.Thai |
Tsonga | tso | LinguaLanguage.Tsonga |
Tswana | tsn | LinguaLanguage.Tswana |
Turkish | tur | LinguaLanguage.Turkish |
Ukrainian | ukr | LinguaLanguage.Ukrainian |
Urdu | urd | LinguaLanguage.Urdu |
Vietnamese | vie | LinguaLanguage.Vietnamese |
Welsh | cym | LinguaLanguage.Welsh |
Xhosa | xho | LinguaLanguage.Xhosa |
Yoruba | yor | LinguaLanguage.Yoruba |
Zulu | zul | LinguaLanguage.Zulu |
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! 👩💻👨💻
Stay updated by following our repository. For any inquiries or support, reach out through the issues page.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Panlingo.LanguageIdentification.Lingua.Native:
Package | Downloads |
---|---|
Panlingo.LanguageIdentification.Lingua
This is a .NET wrapper for the Lingua library, which is an efficient and easy-to-use language detection library. This package simplifies the integration of language identification capabilities into .NET applications, utilizing the Lingua library to accurately and quickly recognize the languages of given texts. Perfect for projects that require lightweight yet reliable language detection. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Initial release