カナワナ <--> KanaWana <--> かなわな
Javascript utility library for checking and converting between Kanji, Hiragana, Katakana, and Romaji
Demo
kaniwani.github.io/KanaWana/demo
Documentation
kaniwani.github.io/KanaWana/docs
Install
npm install kanawana
# or yarn add kanawana
Quick Use
HTML:
<input type="text" id="kanawana-input" />
<script src="node_modules/kanawana/browser/kanawana.min.js"></script>
<script>
const textInput = document.querySelector('#kanawana-input');
kanawana.bind(textInput);
</script>
JavaScript:
const kw = require('kanawana');
import kw from 'kanawana';
import { toKana } from 'kanawana';
import isKanji from 'kanawana/isKanji';
{
useObsoleteKana: false,
passRomaji: false,
upcaseKatakana: false,
IMEMode: false,
}
kw.bind(domElement [, options]);
kw.unbind(domElement);
kw.isJapanese('泣き虫。!〜')
kw.isJapanese('泣き虫.!~')
kw.isKana('あーア')
kw.isHiragana('げーむ')
kw.isKatakana('ゲーム')
kw.isKanji('切腹')
kw.isMixed('お腹A')
kw.isRomaji('Tōkyō and Ōsaka')
kw.toKana('ONAJI buttsuuji')
kw.toKana('座禅‘zazen’スタイル')
kw.toKana('batsuge-mu')
kw.toHiragana('toukyou, オオサカ')
kw.toHiragana('only カナ', { passRomaji: true })
kw.toHiragana('wi', { useObsoleteKana: true })
kw.toKatakana('toukyou, おおさか')
kw.toKatakana('only かな', { passRomaji: true })
kw.toKatakana('wi', { useObsoleteKana: true })
kw.toRomaji('ひらがな カタカナ')
kw.toRomaji('ひらがな カタカナ', { upcaseKatakana: true })
kw.stripOkurigana('お祝い')
kw.stripOkurigana('踏み込む')
kw.stripOkurigana('踏み込む', { all: true })
kw.tokenize('ふふフフ')
kw.tokenize('感じ')
kw.tokenize('I said "私は悲しい"')
Credits
Adapted from the WanaKana Project sponsored by Tofugu & WaniKani
License
This project is licensed under the MIT license, Copyright (c) 2013 WaniKani Community Github. For more information see LICENSE file.