搜尋套件、儲存庫與 APP 分類

套件詳情v2.1.1

kana_kit

一個用於檢測和轉寫平假名、片假名和羅馬字的 Dart 庫。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
6860
喜歡數
40
Pub 分數
160

安裝套件

flutter pub add kana_kit

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

kana_kit 是一個 Dart 庫,專門用於偵測並轉換平假名、片假名與羅馬拼音。它提供精確的解析與轉換工具,適用於日文文字處理,非常適合需要處理日語語言的應用程式。此套件支援多種平台,包含行動裝置、網頁與桌面系統,確保廣泛的相容性。透過簡單的 API,開發者可輕鬆辨識字形類型,並在不同書寫系統間順暢轉換文字。

適用情境

  • 日文文字分析
  • 語言學習應用
  • 文字輸入規範化
  • 在地化工具
  • 日本語輸入驗證

主要特色

  • 腳本檢測(平假名、片假名、羅馬字)
  • 雙向轉寫
  • 跨平台支援
  • 簡單直覺的 API
  • 準確的字元辨識

適合對象

  • 開發日語應用的開發者
  • 學習日語的教育工具
  • 支援日文輸入的國際化應用
  • 日文內容的文本處理流水線

使用建議

  • 僅限日文字符
  • 不處理漢字字元
  • 需要手動處理混合腳本文字
  • 無內建 UI 元件
  • 可能需要額外的邏輯來實現上下文感知的轉換

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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.

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案