Panlingo.LanguageIdentification.Whatlang 0.0.0.22

There is a newer version of this package available.
See the version list below for details.
dotnet add package Panlingo.LanguageIdentification.Whatlang --version 0.0.0.22                
NuGet\Install-Package Panlingo.LanguageIdentification.Whatlang -Version 0.0.0.22                
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.Whatlang" Version="0.0.0.22" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Panlingo.LanguageIdentification.Whatlang --version 0.0.0.22                
#r "nuget: Panlingo.LanguageIdentification.Whatlang, 0.0.0.22"                
#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.Whatlang as a Cake Addin
#addin nuget:?package=Panlingo.LanguageIdentification.Whatlang&version=0.0.0.22

// Install Panlingo.LanguageIdentification.Whatlang as a Cake Tool
#tool nuget:?package=Panlingo.LanguageIdentification.Whatlang&version=0.0.0.22                

Panlingo.LanguageIdentification.Whatlang

Welcome to Panlingo.LanguageIdentification.Whatlang, a .NET wrapper for the Whatlang 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 Whatlang 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
  • Arch: AMD64

Installation

To integrate the Whatlang functionality, follow these steps:

  1. Install the NuGet package:

    dotnet add package Panlingo.LanguageIdentification.Whatlang
    

Usage

Integrating the Whatlang 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.Whatlang package to your project using the provided installation command.
  2. Initialize the Library: Follow the example snippet to initialize and use the Whatlang library for detecting languages.
using Panlingo.LanguageIdentification.Whatlang;

class Program
{
    static void Main()
    {
        // Create an instance of the language detector
        using var whatlang = new WhatlangDetector();

        var texts = new[]
        {
            "Hello, how are you?",
            "Привіт, як справи?",
            "Привет, как дела?",
        };

        var predictions = texts
            .Select(x => new
            {
                Text = x,
                Prediction = whatlang.PredictLanguage(x),
            })
            .ToArray();

        foreach (var x in predictions)
        {
            Console.WriteLine(
                $"Text: {x.Text}, " +
                $"Language: {x.Prediction?.Language.ToString() ?? "NULL"}, " +
                $"Probability: {x.Prediction?.Confidence.ToString() ?? "NULL"}, " +
                $"IsReliable: {x.Prediction?.IsReliable.ToString() ?? "NULL"}, " +
                $"Script: {x.Prediction?.Script.ToString() ?? "NULL"}"
            );
        }
    }
}

Sources

  1. Original Whatlang Repository
  2. N-Gram-Based Text Categorization
  3. Language identification at Wikipedia

Supported languages

Language ISO 639-3 Enum
Esperanto epo WhatlangLanguage.Epo
English eng WhatlangLanguage.Eng
Russian rus WhatlangLanguage.Rus
Mandarin cmn WhatlangLanguage.Cmn
Spanish spa WhatlangLanguage.Spa
Portuguese por WhatlangLanguage.Por
Italian ita WhatlangLanguage.Ita
Bengali ben WhatlangLanguage.Ben
French fra WhatlangLanguage.Fra
German deu WhatlangLanguage.Deu
Ukrainian ukr WhatlangLanguage.Ukr
Georgian kat WhatlangLanguage.Kat
Arabic ara WhatlangLanguage.Ara
Hindi hin WhatlangLanguage.Hin
Japanese jpn WhatlangLanguage.Jpn
Hebrew heb WhatlangLanguage.Heb
Yiddish yid WhatlangLanguage.Yid
Polish pol WhatlangLanguage.Pol
Amharic amh WhatlangLanguage.Amh
Javanese jav WhatlangLanguage.Jav
Korean kor WhatlangLanguage.Kor
Bokmal nob WhatlangLanguage.Nob
Danish dan WhatlangLanguage.Dan
Swedish swe WhatlangLanguage.Swe
Finnish fin WhatlangLanguage.Fin
Turkish tur WhatlangLanguage.Tur
Dutch nld WhatlangLanguage.Nld
Hungarian hun WhatlangLanguage.Hun
Czech ces WhatlangLanguage.Ces
Greek ell WhatlangLanguage.Ell
Bulgarian bul WhatlangLanguage.Bul
Belarusian bel WhatlangLanguage.Bel
Marathi mar WhatlangLanguage.Mar
Kannada kan WhatlangLanguage.Kan
Romanian ron WhatlangLanguage.Ron
Slovene slv WhatlangLanguage.Slv
Croatian hrv WhatlangLanguage.Hrv
Serbian srp WhatlangLanguage.Srp
Macedonian mkd WhatlangLanguage.Mkd
Lithuanian lit WhatlangLanguage.Lit
Latvian lav WhatlangLanguage.Lav
Estonian est WhatlangLanguage.Est
Tamil tam WhatlangLanguage.Tam
Vietnamese vie WhatlangLanguage.Vie
Urdu urd WhatlangLanguage.Urd
Thai tha WhatlangLanguage.Tha
Gujarati guj WhatlangLanguage.Guj
Uzbek uzb WhatlangLanguage.Uzb
Punjabi pan WhatlangLanguage.Pan
Azerbaijani aze WhatlangLanguage.Aze
Indonesian ind WhatlangLanguage.Ind
Telugu tel WhatlangLanguage.Tel
Persian pes WhatlangLanguage.Pes
Malayalam mal WhatlangLanguage.Mal
Oriya ori WhatlangLanguage.Ori
Burmese mya WhatlangLanguage.Mya
Nepali nep WhatlangLanguage.Nep
Sinhalese sin WhatlangLanguage.Sin
Khmer khm WhatlangLanguage.Khm
Turkmen tuk WhatlangLanguage.Tuk
Akan aka WhatlangLanguage.Aka
Zulu zul WhatlangLanguage.Zul
Shona sna WhatlangLanguage.Sna
Afrikaans afr WhatlangLanguage.Afr
Latin lat WhatlangLanguage.Lat
Slovak slk WhatlangLanguage.Slk
Catalan cat WhatlangLanguage.Cat
Tagalog tgl WhatlangLanguage.Tgl
Armenian hye WhatlangLanguage.Hye

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 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 62 12/15/2024
0.2.0 127 11/10/2024
0.1.1 181 10/22/2024
0.0.0.23 110 10/7/2024
0.0.0.22 351 9/22/2024
0.0.0.21 128 9/10/2024
0.0.0.20 116 9/8/2024
0.0.0.19 120 9/1/2024
0.0.0.18 103 8/26/2024
0.0.0.17 140 8/21/2024
0.0.0.16 145 8/9/2024
0.0.0.15 118 8/8/2024
0.0.0.14 87 8/3/2024
0.0.0.13 96 8/1/2024
0.0.0.12 111 7/20/2024
0.0.0.10 91 7/14/2024

- Initial release