All Projects → Cutano → Kawazu

Cutano / Kawazu

Licence: MIT license
A C# library for converting Japanese sentence to Hiragana, Katakana or Romaji with furigana and okurigana modes supported. Inspired by project Kuroshiro.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Kawazu

Nihonoari-App
A little and minimalist Japanese Kana training
Stars: ✭ 66 (+100%)
Mutual labels:  katakana, hiragana, japanese, kana
KanaQuiz
A simple app to quiz the user on identifying Japanese characters.
Stars: ✭ 19 (-42.42%)
Mutual labels:  katakana, hiragana, kana, kanji
kanji-web-app
Angular.js kanji web application
Stars: ✭ 45 (+36.36%)
Mutual labels:  japanese, kana, kanji
wana kana rust
Utility library for checking and converting between Japanese characters - Hiragana, Katakana - and Romaji
Stars: ✭ 46 (+39.39%)
Mutual labels:  katakana, japanese, kana
zkanji
Japanese language study suite and dictionary
Stars: ✭ 55 (+66.67%)
Mutual labels:  japanese, kanji
kanjigrid
Fork of the Kanji Grid addon for Anki
Stars: ✭ 21 (-36.36%)
Mutual labels:  japanese, kanji
kanjigrid
A web-app displaying the 2200 kanji characters taught in James Heisig's "Remembering the Kanji", 6th edition.
Stars: ✭ 37 (+12.12%)
Mutual labels:  japanese, kanji
wanikani-userscripts
Userscripts for the WaniKani.com website
Stars: ✭ 16 (-51.52%)
Mutual labels:  japanese, kanji
limelight
A php Japanese language text analyzer and parser.
Stars: ✭ 76 (+130.3%)
Mutual labels:  japanese, mecab
kanji-frequency
Kanji usage frequency data collected from various sources
Stars: ✭ 92 (+178.79%)
Mutual labels:  japanese, kanji
jiten
jiten - japanese android/cli/web dictionary based on jmdict/kanjidic — 日本語 辞典 和英辞典 漢英字典 和独辞典 和蘭辞典
Stars: ✭ 64 (+93.94%)
Mutual labels:  japanese, kanji
kanji
Haskell suite for determining what 級 (level) of the 漢字検定 (national Kanji exam) a given Kanji belongs to.
Stars: ✭ 19 (-42.42%)
Mutual labels:  japanese, kanji
Zipangu
A library for compatibility about Japan.
Stars: ✭ 27 (-18.18%)
Mutual labels:  japanese, kana
jaco-js
Japanese character optimizer for JavaScript
Stars: ✭ 72 (+118.18%)
Mutual labels:  katakana, hiragana
sakubun
A tool that helps you improve your Japanese vocabulary and kanji skills with practice that's customized to your needs.
Stars: ✭ 20 (-39.39%)
Mutual labels:  japanese, kanji
migemojs
a JavaScript implementation of Migemo
Stars: ✭ 29 (-12.12%)
Mutual labels:  kana, kanji
kanji-handwriting-swift
Kanji handwriting recognition for iOS using Zinnia.
Stars: ✭ 27 (-18.18%)
Mutual labels:  japanese, kanji
ibus-hanjp
An Input method that enables to write Japanese script by typing its pronunciation in Korean hangul script.
Stars: ✭ 20 (-39.39%)
Mutual labels:  kana
Convert-Numbers-to-Japanese
Converts Arabic numerals, or 'western' style numbers, to a Japanese context.
Stars: ✭ 33 (+0%)
Mutual labels:  japanese
Vimdoc Ja
A project which translate Vim documents into Japanese.
Stars: ✭ 245 (+642.42%)
Mutual labels:  japanese

Kawazu

Kawazu Library For C#

Kawazu is a C# library for converting Japanese sentence to Hiragana, Katakana or Romaji with furigana and okurigana modes supported. Inspired by project Kuroshiro.

Package NuGet ID NuGet Status
Kawazu Kawazu Stat

Features

  • Japanese Sentence => Hiragana, Katakana or Romaji
  • Furigana and okurigana supported
  • Multiple romanization systems supported
  • Useful Japanese utilities

Usage

Install

The package can be installed by NuGet:

Install-Package Kawazu

Or reference it in your project:

<PackageReference Include="Kawazu" Version="1.1.4" />

The package size is over 50MB for it contains dictionary file, please take this in to account when you are building a size-sensitive project.

Quick Start

First, import the Kawazu namespace by:

using Kawazu;

Then initiate the converter:

var converter = new KawazuConverter();

Or specify a custom dictionary path:

var converter = new KawazuConverter(path);

Finally you will get the result by:

var result = await converter.Convert("今晩は", To.Romaji, Mode.Okurigana, RomajiSystem.Hepburn, "(", ")");

For the “Convert” method is an async method, you probably need to make the outer method async too:

private static async Task Main(string[] args)
{
    // Your code ...
    var converter = new KawazuConverter();
    var result = await converter.Convert("今晩は", To.Romaji, Mode.Okurigana, RomajiSystem.Hepburn, "(", ")");
    // Your code ...
}

See the demo Kawazu-Cli for more details.

Advanced Usage

KawazuConverter Class

Method “Convert” accepts six parameters, the last five of which are optional. The first parameter is the original Japanese string, the second one is the target form of the sentence, the third one is the presentation method of the result, the forth one is the writing systems of romaji and the last two are delimiters. It will return the result string as a async task.

Method “GetDivisions” accepts exactly the same six parameters as “Convert”, but returns the raw result from the word Separator.

Division Class

Represents the division from the word separator.

JapaneseElement Class

A single reading element in a Japanese sentence. For example, in sentence "今日の映画は面白かった。" "今日","の","映画","は","面白","か","っ","た" are all JapaneseElement in this condition. For each of them represents a unit of pronunciation.

Utilities Class

Provides several useful Japanese utilities.

Typical Usage

The code below shows the typical usage of Kawazu converter in a command line application.

C# language level: 8

private static async Task Main(string[] args)
        {
            Console.WriteLine("Kawazu-Cli Japanese Converter Version 1.0.0");
            Console.WriteLine("Type 'exit' to quit");
            Console.WriteLine();
            
            var converter = new KawazuConverter();

            while (true)
            {
                Console.WriteLine("Original Japanese Sentence:");
                Console.Write("> ");
                var str = Console.ReadLine();
                if (string.IsNullOrWhiteSpace(str))
                {
                    continue;
                }

                if (str == "exit")
                {
                    return;
                }
                
                Console.WriteLine("Target form ('1':Romaji '2':Hiragana '3':Katakana Default:Hiragana):");
                Console.Write("> ");
                var toStr = Console.ReadLine();
                var to = toStr switch
                {
                    "1" => To.Romaji,
                    "2" => To.Hiragana,
                    "3" => To.Katakana,
                    _ => To.Hiragana
                };
                
                Console.WriteLine("Presentation mode ('1':Normal '2':Spaced '3':Okurigana '4':Furigana Default:Okurigana):");
                Console.Write("> ");
                var modeStr = Console.ReadLine();
                var mode = modeStr switch
                {
                    "1" => Mode.Normal,
                    "2" => Mode.Spaced,
                    "3" => Mode.Okurigana,
                    "4" => Mode.Furigana,
                    _ => Mode.Okurigana
                };

                var system = RomajiSystem.Hepburn;
                if (to == To.Romaji)
                {
                    Console.WriteLine("Romaji system ('1':Nippon '2':Passport '3':Hepburn Default:Hepburn):");
                    Console.Write("> ");
                    var systemStr = Console.ReadLine();
                    system = systemStr switch
                    {
                        "1" => RomajiSystem.Nippon,
                        "2" => RomajiSystem.Passport,
                        "3" => RomajiSystem.Hepburn,
                        _ => RomajiSystem.Hepburn
                    };
                }
                var result = await converter.Convert(str, to, mode, system, "(", ")");
                Console.WriteLine(result);
                Console.WriteLine();
            }
        }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].