搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目