Skip to content

mariten/kanatools-java

Repository files navigation

Japanese Kana Utilities for Java

Download Build Status Coverage Status

日本語

  • kanatools-java とは、Java にて日本語文字処理を簡単にやってくれる小さなライブラリです。
  • 数行のコードだけで、仮名やローマ字の変換等の処理が素早くできます。
  • Java 1.5 以上で使用できます。
  • 詳細を見る...

English

  • kanatools-java is a small collection of utilities that make your life easier when dealing with Japanese text.
  • Quickly process text containing kana characters with just a few lines of code.
  • Works with Java 1.5 and above
  • Read more...

Classes

KanaConverter

Example

Code:

import com.mariten.kanatools.KanaConverter;
...

String before = "かな変換テスティーング。 1-2-3";

int conv_op_flags = 0;
conv_op_flags |= KanaConverter.OP_HAN_KATA_TO_ZEN_KATA;    //半角カタカナを全角カタカナに変換
conv_op_flags |= KanaConverter.OP_ZEN_ASCII_TO_HAN_ASCII;  //全角英数字を半角英数字に変換

String after = KanaConverter.convertKana(before, conv_op_flags);

Effect:

before: "かな変換テスティーング。 1-2-3"
after:  "カナ変換テスティーング。 1-2-3"

Download and Install

Option 1: Auto-Include as Dependency in Build Tool

This library is available on the large public JAR repositories JCenter and Maven Central

Package Metadata

  • Group
    • com.mariten
  • Artifact
    • kanatools
  • Version
    • Version

Option 2: Directly Download JAR File

  1. The JAR for each stable version release is hosted on Bintray - Download the latest here
  2. Add to your lib directory or somewhere that is included in your Java CLASSPATH

Development

Requirements

  • ☕ Java
    • JDK 1.5+ for users (those who just want to include the JAR in their own project)
    • JDK 1.6+ for contributors (those who want to build and test the code in this library)
  • 🐜 Ant
    • 🐘 Gradle 2.1+ builds are supported as well
  • 🈶 Japanese text display for your editor or console

Setup

Perform the following process on the command line

git clone https://github.com/mariten/kanatools-java.git
cd kanatools-java
git checkout staging

# Compile and test with Ant
ant test

# Compile and test with Gradle
./gradlew check

When you see the BUILD SUCCESSFUL message you are good to go 👍

Making Pull Requests

Please follow this process:

  1. If you are considering major changes, please consult me before starting (even just briefly)
  2. Fork this repository
  3. Make your changes in a new branch. Please add or update unit tests accordingly.
  4. Ensure that ant test and ./gradlew check complete successfully. Pull requests with failing or buggy unit tests will be rejected.
  5. Send the pull request to the staging branch and include an explanation of what your change accomplishes. Please do not commit the Kanatools JAR file in your pull request, that is only done when a new version is released.
  6. After a code review and upon passing all tests, your change will be merged into staging.
  7. When the next version is released these changes will be reflected into the master branch and subsequently included to the JAR published to JCenter and Maven Central.
  8. Depending on the nature of the change, updating the documentation in the gh-pages branch would be appreciated as well.

Looking forward to your pull requests! 📝 :octocat: