Iconic.Transliterator 2.0.0

dotnet add package Iconic.Transliterator --version 2.0.0                
NuGet\Install-Package Iconic.Transliterator -Version 2.0.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="Iconic.Transliterator" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Iconic.Transliterator --version 2.0.0                
#r "nuget: Iconic.Transliterator, 2.0.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 Iconic.Transliterator as a Cake Addin
#addin nuget:?package=Iconic.Transliterator&version=2.0.0

// Install Iconic.Transliterator as a Cake Tool
#tool nuget:?package=Iconic.Transliterator&version=2.0.0                

Transliterator

.NET GitHub tag (latest SemVer) Nuget

A library that can help with any text transliteration, like slug creation. It supports multiple languages and can accept new ones very easily.

Latest changes:
V2 minimized the library's memory and cpu footprint and simplified the Conversion Classes

Usage

You can install the library through NuGet

NuGet\Install-Package Iconic.Transliterator -Version 2.0.0

Here is a brief sample of how you can use the library

var transliterator = new Transliterator();
transliterator.addConversion(new GreekToEnglish());

var message = "Σεβόμαστε την ιδιωτικότητά σας";
var transliterated = transliterator.convert(message);  // "Sevomaste tin idiotikotita sas"

transliterator.addConversion(new EnglishToSlug());

var slug = transliterator.convert(message); // "sevomaste-tin-idiotikotita-sas"

You can add all the conversions that you want. The combinations are sorted by length. Larger matches are applied first, so that smaller matches do not ruin larger them.

Languages

New conversions can be added by creating a new class and implementing the IConversion Interface.

V2 simplified the Conversion classes. The combinations are now kept in a single Dictionary which is internally sorted by match length.

Combination matches should be defined in lower case. The transliterator handles capitalization automatically.

The final part of the IConversion Interface defines a general purpose transformation for the entire text. Can be used for things like ToLower() etc.

This way, we can create conversion classes to do whatever transformations we need. For example, we could create a Profanity class, and replace all nasty words in our Profanity DB table with ******.

There are currently classes for GreekToEnglish, GermanToEnglish, CyrillicToEnglish and EnglishToSlug. Conversion choices are not meant to be proper Romanization, but rather what would be easy to understand in social media. I don't speak German or any language that uses the Cyrillic alphabet, so I can't verify the functionality or completeness of those classes. Please help if you see something wrong. The Slug is a pseudo language that defines the replacement rules to produce proper slugs. It currently eliminates multiple spaces, replaces them with dashes, and converts everything to lower case.

TODO:

  • Add functionality to allow more complex conversions like markdown to html
Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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
2.0.0 295 3/12/2023
1.1.2 233 2/27/2023
1.1.1 236 2/27/2023
1.0.0 250 2/26/2023

V2 minimized the library's memory and cpu footprint and simplified the Conversion Classes