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

Copyright(c) Colin Woodbury 2015 2016
LicenseGPL3
MaintainerColin Woodbury <colingw@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Data.Kanji

Contents

Description

A library for analysing the density of Kanji in given texts, according to their Level classification, as defined by the Japan Kanji Aptitude Testing Foundation (日本漢字能力検定協会).

Synopsis

Kanji

class AsKanji a where Source #

Anything that can be transformed into a list of Kanji.

Methods

_Kanji :: Traversal' a Kanji Source #

Traverse into this type to find 0 or more Kanji.

Despite what the Haddock documentation says, this is part of the minimal complete definition.

asKanji :: a -> [Kanji] Source #

Transform this string type into a list of Kanji. The source string and the resulting list might not have the same length, if there were Char in the source that did not fall within the legal UTF8 range for Kanji.

newtype Kanji Source #

A single symbol of Kanji. Japanese Kanji were borrowed from China over several waves during the past millenium. Japan names 2136 of these as their standard set, with rarer characters being the domain of academia and esoteric writers.

Japanese has several Japan-only Kanji, including:

  • 畑 (a type of rice field)
  • 峠 (a narrow mountain pass)
  • 働 (to do physical labour)

Constructors

Kanji 

Fields

Instances

Eq Kanji Source # 

Methods

(==) :: Kanji -> Kanji -> Bool #

(/=) :: Kanji -> Kanji -> Bool #

Ord Kanji Source # 

Methods

compare :: Kanji -> Kanji -> Ordering #

(<) :: Kanji -> Kanji -> Bool #

(<=) :: Kanji -> Kanji -> Bool #

(>) :: Kanji -> Kanji -> Bool #

(>=) :: Kanji -> Kanji -> Bool #

max :: Kanji -> Kanji -> Kanji #

min :: Kanji -> Kanji -> Kanji #

Show Kanji Source # 

Methods

showsPrec :: Int -> Kanji -> ShowS #

show :: Kanji -> String #

showList :: [Kanji] -> ShowS #

allKanji :: [Set Kanji] Source #

All Japanese Kanji, grouped by their Level (級) in ascending order. Here, ascending order means from the lowest to the highest level, meaning from 10 to 1.

isKanji :: Char -> Bool Source #

Legal Kanji appear between UTF8 characters 19968 and 40959.

hasLevel :: Kanji -> Bool Source #

Is the Level of a given Kanji known?

Levels

data Level Source #

A Level or Kyuu (級) of Japanese Kanji ranking. There are 12 of these, from 10 to 1, including intermediate levels between 3 and 2, and 2 and 1.

Japanese students will typically have Level-5 ability by the time they finish elementary school. Level-5 accounts for 1006 characters.

By the end of middle school, they would have covered up to Level-3 (1607 Kanji) in their Japanese class curriculum.

While Level-2 (2136 Kanji) is considered "standard adult" ability, many adults could not pass the Level-2, or even the Level-Pre2 (1940 Kanji) exam without considerable study.

Level data for Kanji above Level-2 is currently not provided by this library.

Constructors

Level 

Fields

Instances

Eq Level Source # 

Methods

(==) :: Level -> Level -> Bool #

(/=) :: Level -> Level -> Bool #

Show Level Source # 

Methods

showsPrec :: Int -> Level -> ShowS #

show :: Level -> String #

showList :: [Level] -> ShowS #

data Rank Source #

A numeric representation of a Level.

Constructors

Ten 
Nine 
Eight 
Seven 
Six 
Five 
Four 
Three 
PreTwo 
Two 
PreOne 
One 

Instances

level :: Kanji -> Maybe Level Source #

What Level does a Kanji belong to?

levels :: [Level] Source #

All Levels, with all their Kanji, ordered from Level-10 to Level-2.

isKanjiInLevel :: Level -> Kanji -> Bool Source #

Does a given Kanji belong to the given Level?

levelFromRank :: Rank -> Maybe Level Source #

Is there a Level that corresponds with a given Rank value?

Analysis

percentSpread :: [Kanji] -> [(Kanji, Float)] Source #

The distribution of each Kanji in a set of them. The distribution values must sum to 1.

levelDist :: [Kanji] -> [(Rank, Float)] Source #

How much of each Level is represented by a group of Kanji?

averageLevel :: [Kanji] -> Float Source #

Find the average Level of a given set of Kanji.

uniques :: [Kanji] -> [(Rank, [Kanji])] Source #

Which Kanji appeared from each Level in the text?

Densities

kanjiDensity :: Int -> [Kanji] -> Float Source #

What is the density d of Kanji characters in a given String-like type, where 0 <= d <= 1?

elementaryDen :: [(Rank, Float)] -> Float Source #

How much of the Kanji found are learned in elementary school in Japan?

elementaryDen . levelDist :: [Kanji] -> Float

middleDen :: [(Rank, Float)] -> Float Source #

How much of the Kanji found are learned by the end of middle school?

middleDen . levelDist :: [Kanji] -> Float

highDen :: [(Rank, Float)] -> Float Source #

How much of the Kanji found are learned by the end of high school?

highDen . levelDist :: [Kanji] -> Float

adultDen :: [(Rank, Float)] -> Float Source #

How much of the Kanji found should be able to read by the average person?

adultDen . levelDist :: [Kanji] -> Float