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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Panlingo.LanguageIdentification.Lingua.Native" Version="0.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Panlingo.LanguageIdentification.Lingua.Native --version 0.3.0                
#r "nuget: Panlingo.LanguageIdentification.Lingua.Native, 0.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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:

  1. 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:

  1. Install the Package: Ensure you have added the Panlingo.LanguageIdentification.Lingua package to your project using the provided installation command.
  2. 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:

Sources

  1. Original Lingua Repository
  2. Language identification at Wikipedia

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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.

Version Downloads Last updated
0.3.0 684 12/15/2024
0.2.0 1,160 11/10/2024
0.1.1 499 10/22/2024
0.0.0.23 349 10/7/2024
0.0.0.22 933 9/22/2024
0.0.0.21 386 9/10/2024
0.0.0.20 334 9/8/2024
0.0.0.19 289 9/1/2024
0.0.0.18 302 8/26/2024
0.0.0.17 476 8/21/2024

- Initial release