Skip to content

Transform kana to en|ru language or vice versa, using specific transliteration system; convert one kana to the other syllabary

License

Notifications You must be signed in to change notification settings

18degrees/kana-transformer

Repository files navigation

Kana transformer

logo

NPM Version test NPM License

Switch the language to: Russian

Try out the functionality on the website

With the library, you will be able to:

  • Transform Russian or English syllables into kana
  • Turn kana to the Russian or English alphabet
  • Convert one kana to the other

There is a function to perform each item.

Before using them, see the functions overview for limitations and recommendations. Keeping the recommendations in mind will improve accuracy, and keeping the limitations in mind will prepare you for the shortcomings of the algorithm.

Documentation

Installation

npm install kana-transformer

Default behaviour

  • toKana() understands English, by Hepburn system; returns hiragana
  • fromKana() returns English, by Hepburn system
  • convertKana() converts to hiragana

More details about the customization options are written in functions overview.

Usage examples

import { fromKana, toKana, convertKana } from 'kana-transformer'
//Recommendation: in the first two functions, separate words with a space

fromKana('わたし は じぶん に おちゃ を たてました')
// => 'watashi wa jibun ni ocha o tatemashita'

toKana('watashi wa jibun ni ocha o tatemashita')
// => 'わたし は じぶん に おちゃ を たてました'

convertKana('ワタシハジブンニオチャヲタテマシタ')
// => 'わたしはじぶんにおちゃをたてました'

Contributing

If you have a suggestion for improving the library, feel free to use issues and pull requests.

License

Apache-2.0