Search packages, repositories and app categories

Package detailsv2.1.1

kana_kit

A Dart library for for detecting and transliterating Hiragana, Katakana, and Romaji.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
6.9K
Likes
40
Pub points
160

Install package

flutter pub add kana_kit

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

kana_kit is a Dart library designed to detect and transliterate between Hiragana, Katakana, and Romaji. It provides accurate parsing and conversion utilities for Japanese text, making it ideal for applications involving Japanese language processing. The package supports multiple platforms, including mobile, web, and desktop, ensuring broad compatibility. With simple APIs, it enables developers to identify script types and convert text seamlessly across writing systems.

Use cases

  • Japanese text analysis
  • Language learning apps
  • Text input normalization
  • Localization tools
  • Input validation for Japanese text

Key features

  • Script detection (Hiragana, Katakana, Romaji)
  • Bidirectional transliteration
  • Cross-platform support
  • Simple and intuitive API
  • Accurate character recognition

Suitable for

  • Developers building Japanese language apps
  • Educational tools for learning Japanese
  • Internationalized applications with Japanese input
  • Text processing pipelines for Japanese content

Considerations

  • Limited to Japanese scripts only
  • Does not handle Kanji characters
  • Requires manual handling of mixed-script text
  • No built-in UI components
  • May need additional logic for context-aware conversions

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

KanaKit (かな・キット)

A Dart library for for detecting and transliterating Hiragana, Katakana, and Romaji.


This library is mostly a direct port of WaniKani's WanaKana JavaScript library.

Usage

To use KanaKit, construct a KanaKit class instance. It contains all available methods for detecting and converting Japanese text.

// Create a KanaKit instance.
//
// You can optionally provide a config of type KanaKitConfig.
// If no config is provided, KanaKitConfig.defaultConfig is used.
const kanaKit = KanaKit();

// Checks
kanaKit.isJapanese('泣き虫。!~2¥zenkaku') // true

kanaKit.isKana('あーア') // true

kanaKit.isHiragana('すげー') // true

kanaKit.isKatakana('ゲーム') // true

kanaKit.isKanji('切腹') // true
kanaKit.isKanji('勢い') // false

kanaKit.isRomaji('Tōkyō and Ōsaka') // true

// Converters
kanaKit.toKana('ONAJI buttsuuji') // 'オナジ ぶっつうじ'
kanaKit.toKana('座禅‘zazen’スタイル') // '座禅「ざぜん」スタイル'
kanaKit.toKana('batsuge-mu') // 'ばつげーむ'

kanaKit.toHiragana('toukyou, オオサカ') // 'とうきょう、 おおさか'
kanaKit.toKatakana('toukyou, おおさか') // 'トウキョウ、 オオサカ'

kanaKit.toRomaji('ひらがな カタカナ') // 'hiragana katakana'

// Use upcaseKatakana to capitalize characters that were converted from Katakana.s
kanaKit
  .copyWithConfig(upcaseKatakana: true)
  .toRomaji('ひらがな カタカナ') // 'hiragana KATAKANA'
LICENSE

MIT License

Copyright (c) 2024 Jeroen Meijer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package