All Projects → PSeitz → wana_kana_rust

PSeitz / wana_kana_rust

Licence: MIT License
Utility library for checking and converting between Japanese characters - Hiragana, Katakana - and Romaji

Programming Languages

rust
11053 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to wana kana rust

Nihonoari-App
A little and minimalist Japanese Kana training
Stars: ✭ 66 (+43.48%)
Mutual labels:  katakana, japanese, romaji, kana
Kawazu
A C# library for converting Japanese sentence to Hiragana, Katakana or Romaji with furigana and okurigana modes supported. Inspired by project Kuroshiro.
Stars: ✭ 33 (-28.26%)
Mutual labels:  katakana, japanese, kana
Zipangu
A library for compatibility about Japan.
Stars: ✭ 27 (-41.3%)
Mutual labels:  japanese, kana
kanji-web-app
Angular.js kanji web application
Stars: ✭ 45 (-2.17%)
Mutual labels:  japanese, kana
KanaQuiz
A simple app to quiz the user on identifying Japanese characters.
Stars: ✭ 19 (-58.7%)
Mutual labels:  katakana, kana
migemojs
a JavaScript implementation of Migemo
Stars: ✭ 29 (-36.96%)
Mutual labels:  romaji, kana
svg2vector
Online batch converter of SVG images to Android vector drawable XML resource files
Stars: ✭ 39 (-15.22%)
Mutual labels:  converter
psd-to-sketch-converter
Convert PSD to Sketch for free
Stars: ✭ 42 (-8.7%)
Mutual labels:  converter
Numbase
Arbitrary number base converter.
Stars: ✭ 22 (-52.17%)
Mutual labels:  converter
dinputto8
A dll module that is designed to improve compatibility in games using DirectInput 1-7 (dinput.dll) by converting all API calls to their equivalent DirectInput 8 (dinput8.dll) ones. This allows older games to be able to use newer tools and wrappers written for DirectInput 8.
Stars: ✭ 42 (-8.7%)
Mutual labels:  converter
OpenDriver2Tools
Driver 1 and Driver 2 tools
Stars: ✭ 25 (-45.65%)
Mutual labels:  converter
safe-marked
Markdown to HTML using marked and DOMPurify. Safe by default.
Stars: ✭ 31 (-32.61%)
Mutual labels:  converter
dcc-web
Convert docker run/create commands to docker-compose.yml files.
Stars: ✭ 27 (-41.3%)
Mutual labels:  converter
KWDLC
Kyoto University Web Document Leads Corpus
Stars: ✭ 64 (+39.13%)
Mutual labels:  japanese
tipograph
A little javascript library and command line tool that makes your written content more typographically correct.
Stars: ✭ 52 (+13.04%)
Mutual labels:  converter
EPUB-to-PDF
Telegram bot EPUB to PDF converter
Stars: ✭ 25 (-45.65%)
Mutual labels:  converter
webp-wasm
Webp image convertor (webassembly, works offline in browser)
Stars: ✭ 18 (-60.87%)
Mutual labels:  converter
jp-ocr-prunned-cnn
Attempting feature map prunning on a CNN trained for Japanese OCR
Stars: ✭ 15 (-67.39%)
Mutual labels:  japanese
md2review
a converter from Markdown into Re:VIEW, using redcarpet
Stars: ✭ 74 (+60.87%)
Mutual labels:  converter
docscii
DocBook to AsciiDoc converter
Stars: ✭ 14 (-69.57%)
Mutual labels:  converter

Crates.io Docs Build Status Coverage Status

WanaKana Rust

ワナカナ <--> WanaKana <--> わなかな

[dependencies]
wana_kana = "2.0"

Utility library for checking and converting between Japanese characters - Hiragana, Katakana - and Romaji (Ported from https://github.com/WaniKani/WanaKana V4.0.2)

Examples

use wana_kana::to_romaji::*;
use wana_kana::to_kana::*;
use wana_kana::to_hiragana::*;
use wana_kana::Options;
assert_eq!(to_romaji("ワナカナ"), "wanakana");
assert_eq!(to_hiragana("WanaKana"), "わなかな");
assert_eq!(to_kana("WANAKANA"), "ワナカナ");

Tests

100% coverage

Performance

On Migrating to 2.0 some performance improvements have been implemented by using more efficient lookup structures and avoiding allocations. According to these results around 1000 words can be converted per millisecond on a Core i7-6700.

 bench_hiragana_to_romaji    3,519            1,070              -2,449  -69.59%   x 3.29
 bench_kana_1                3,066            567                -2,499  -81.51%   x 5.41
 bench_kana_2                8,006            1,831              -6,175  -77.13%   x 4.37
 bench_katakana_to_hiragana  2,512            622                -1,890  -75.24%   x 4.04
 bench_katakana_to_katakana  1,664            629                -1,035  -62.20%   x 2.65
 bench_katakana_to_romaji    6,922            1,067              -5,855  -84.59%   x 6.49
 bench_romaji_to_hiragana    3,802            1,300              -2,502  -65.81%   x 2.92
 bench_romaji_to_katakana    4,361            1,929              -2,432  -55.77%   x 2.26

Comparison To WanaKana

A detailed analysis has been done in the bench_compare subfolder, the analysis below may be inaccurate.

A short comparison suggests around 25x performance

import toKana from './src/toKana';
import toHiragana from './src/toHiragana';
import toKatakana from './src/toKatakana';
import toRomaji from './src/toRomaji';


console.time("yo")
for (var i = 0; i < 1000; i++) {
    toKana('aiueosashisusesonaninunenokakikukeko')
    toKana('AIUEOSASHISUSESONANINUNENOKAKIKUKEKO')
    toHiragana('aiueosashisusesonaninunenokakikukeko')
    toHiragana('アイウエオサシスセソナニヌネノカキクケコ')
    toKatakana('aiueosashisusesonaninunenokakikukeko')
    toKatakana('あいうえおさしすせそなにぬねのかきくけこ')
    toRomaji('あいうえおさしすせそなにぬねのかきくけこ')
    toRomaji('アイウエオサシスセソナニヌネノカキクケコ')
}

console.timeEnd("yo")

node -r esm run.js

extern crate wana_kana;
use wana_kana::to_hiragana::to_hiragana;
use wana_kana::to_katakana::to_katakana;
use wana_kana::to_romaji::to_romaji;
use wana_kana::to_kana::*;


fn main() {
    let start = std::time::Instant::now();
    for _ in 0..1000 {
        to_kana("aiueosashisusesonaninunenokakikukeko");
        to_kana("AIUEOSASHISUSESONANINUNENOKAKIKUKEKO");
        to_hiragana("aiueosashisusesonaninunenokakikukeko");
        to_hiragana("アイウエオサシスセソナニヌネノカキクケコ");
        to_katakana("aiueosashisusesonaninunenokakikukeko");
        to_katakana("あいうえおさしすせそなにぬねのかきくけこ");
        to_romaji("あいうえおさしすせそなにぬねのかきくけこ");
        to_romaji("アイウエオサシスセソナニヌネノカキクケコ");
    }

    println!("{:?}", start.elapsed().as_millis());
}

node -r esm run.js 253.231ms

cargo run --release --bin bench 9ms

CLI

Convert to kana and back for fun and profit

cargo install wana_kana will install 2 CLI tools: to_kana and to_romaji.

Both commands support piping ls | to_kana and parameters to_romaji へろ をるど.

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].