csharp-kana 1.0.2

dotnet add package csharp-kana --version 1.0.2
                    
NuGet\Install-Package csharp-kana -Version 1.0.2
                    
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="csharp-kana" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="csharp-kana" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="csharp-kana" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add csharp-kana --version 1.0.2
                    
#r "nuget: csharp-kana, 1.0.2"
                    
#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.
#:package csharp-kana@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=csharp-kana&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=csharp-kana&version=1.0.2
                    
Install as a Cake Tool

csharp-kana

Intro

csharp-kana is a lightweight library for converting Japanese kana to romaji and vice versa.

It is written in Csharp and uses a simple algorithm to perform the conversion.

Usage

var raw1 = "これでもやれるだけ飞ばしてきたんだよ";
var res1 = Kana.Kana.KanaToRomaji(raw1, Error.Default, false).ToStr();
Console.WriteLine("test1: Kana->romaji (Default)");
Console.WriteLine($"{raw1} -> {res1}");

var res2 = Kana.Kana.RomajiToKana(res1, Error.Default, KanaType.Hiragana).ToStrList();
Console.WriteLine("test2: romaji->Hiragana");
Console.WriteLine($"{res1} -> {string.Join(" ", res2)}");

var res3 = Kana.Kana.ConvertKana(string.Join(" ", res2), Error.Default, KanaType.Katakana);
Console.WriteLine("test3: Hiragana->Katakana");
Console.WriteLine($"{string.Join(" ", res2)} -> {string.Join(" ", res3)}");

var raw2 = "こん好にちは";
var res4 = Kana.Kana.KanaToRomaji(raw2, Error.Ignore, true).ToStr();
Console.WriteLine("test4: Kana->romaji (Ignore)");
Console.WriteLine($"{raw2} -> {res4}");

Console.WriteLine("test5: IsKana");
Console.WriteLine($"こ -> {Kana.Kana.IsKana("こ")}");

Doc

//  Kana.cs
public struct RomajiRes
{
    public string Kana;
    public string Romaji;
    public bool Error;       //  Whether the conversion failed.
}

public class RomajiResList : List<RomajiRes>
{
    //  Convert to utf-16 string list.
    public List<string> ToStrList();

    //  Convert to utf-16 string with delimiter(default: " ").
    public string ToStr(string delimiter = " ");
}

public struct KanaRes
{
    public string Romaji;
    public string Kana;
    public bool Error;      //  Whether the conversion failed.
}

public class KanaResResList : List<KanaRes> { ... }

//  Kana.cs
enum class Error {
    // Keep original characters
    Default = 0,
    // Ignore this character (do not export)
    Ignore = 1
};

//  Kana.cs
public enum KanaType
{
    Hiragana, Katakana
}

// Split Chinese/English/Kana string into a list of characters.
public static List<string> SplitString(string input)

// IsKana
public static bool IsKana(char input)
public static bool IsKana(string input)

// Convert between Hiragana and Katakana.
public static string ConvertKana(string kana, Error error = Error.Default, KanaType kanaType = KanaType.Hiragana)
public static List<string> ConvertKana(List<string> kanaList, Error error = Error.Default, KanaType kanaType = KanaType.Hiragana)

// KanaToRomaji
public static RomajiResList KanaToRomaji(string kanaStr, Error error = Error.Default, bool doubleWrittenSokuon = false)
public static RomajiResList KanaToRomaji(List<string> kanaList, Error error = Error.Default, bool doubleWrittenSokuon = false)

// RomajiToKana
public static KanaResResList RomajiToKana(string romajiStr, Error error = Error.Default, KanaType kanaType = KanaType.Hiragana)
public static KanaResResList RomajiToKana(List<string> romajiList, Error error = Error.Default, KanaType kanaType = KanaType.Hiragana)
  • cpp-kana A lightweight library for converting Japanese kana to romaji and vice versa.

  • pinyin-makedict A tool for creating Chinese/Cantonese dictionaries.

  • cpp-pinyin A C++ implementation of Chinese/Cantonese to Pinyin library.

  • csharp-pinyin A Csharp implementation of Chinese/Cantonese to Pinyin library.

  • python-pinyin A Python implementation of Chinese to Pinyin library.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on csharp-kana:

Repository Stars
stakira/OpenUtau
Open singing synthesis platform / Open source UTAU successor
LiuYunPlayer/TuneLab
Version Downloads Last Updated
1.0.2 1,752 5/7/2025
1.0.1 10,545 9/10/2024
1.0.0 125 9/10/2024