kanji: Perform 漢字検定 (Japan Kanji Aptitude Test) level analysis on Japanese Kanji

[ bsd3, data, library ] [ Propose Tags ]

Perform 漢字検定 (Japan Kanji Aptitude Test) level analysis on Japanese Kanji.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 1.0.0, 2.0.0, 3.0.2, 3.1.0,, 3.2.0, 3.2.1, 3.3.0, 3.4.0,,, 3.4.1, 3.5.0
Change log CHANGELOG.md
Dependencies aeson (>=2.0 && <2.1), base (>=4.7 && <5), containers (>=0.5.8), deepseq, hashable, text [details]
License BSD-3-Clause
Copyright 2011 - 2022 Colin Woodbury
Author Colin Woodbury
Maintainer colin@fosskers.ca
Category Data
Home page https://github.com/fosskers/kanji
Uploaded by fosskers at 2021-12-08T21:27:14Z
Downloads 7001 total (21 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-12-08 [all 1 reports]

Readme for kanji-3.5.0

[back to package description]


kanji is a Japanese Kanji library and analysation program written in Haskell. Its main function is to tell what Kanji belong to what Level of the Japanese National Kanji Examination (漢字検定).

kanji can be used to:

  • determine what Level individual Kanji belong to
  • determine the average Level (difficulty, in other words) of a group of Kanji
  • apply the above to whole files of Japanese


First, get the source files from:


kanji is written in Haskell and uses the stack tool. Once stack is installed, move to the source directory and perform:

stack install


Assuming you've made it so that you can run the executable, the following command-line options are available:

Usage: kanji [-d|--density] [-e|--elementary] [-l|--leveldist] [-s|--splits]
             ((-f|--file ARG) | JAPANESE)

Available options:
  -h,--help                Show this help text
  -d,--density             Find how much of the input is made of Kanji
  -e,--elementary          Find density of Kanji learnt in elementary school
  -l,--leveldist           Find the distribution of Kanji levels
  -s,--splits              Show which Level each Kanji belongs to
  -f,--file ARG            Take input from a file


  • All options above can be mixed to include their analysis result in the output JSON.
  • -h will over-ride any other options or arguments, discarding them and printing a help message.


Single Kanji

$> kanji -s 日
    "levelSplit": {
        "Ten": [

A Japanese sentence

$> kanji -s これは日本語
    "levelSplit": {
        "Nine": ["語"],
        "Ten": ["本", "日"]

All options

$> kanji -sled これは日本語。串と糞
    "levelSplit": {
        "Nine": ["語"],
        "Ten": ["本", "日"],
        "Unknown": ["糞"],
        "Two": ["串"]
    "elementary": 0.6,
    "density": 0.5,
    "distributions": {
        "Nine": 0.2,
        "Ten": 0.4,
        "Unknown": 0.2,
        "Two": 0.2