-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Perform 漢字検定 (Japan Kanji Aptitude Test) level analysis on Japanese Kanji
--   
--   Perform 漢字検定 (Japan Kanji Aptitude Test) level analysis on Japanese
--   Kanji.
@package kanji
@version 3.4.0


-- | All Kanji from levels 10 to Pre-2.
module Data.Kanji.Levels

-- | The Kanji unique to Level-10, studied by the end of 1st grade in
--   Japanese elementary schools.
tenth :: Set Char

-- | The Kanji unique to Level-9, studied by the end of 2nd grade in
--   Japanese elementary schools.
ninth :: Set Char

-- | The Kanji unique to Level-8, studied by the end of 3rd grade in
--   Japanese elementary schools.
eighth :: Set Char

-- | The Kanji unique to Level-7, studied by the end of 4th grade in
--   Japanese elementary schools.
seventh :: Set Char

-- | The Kanji unique to Level-6, studied by the end of 5th grade in
--   Japanese elementary schools.
sixth :: Set Char

-- | The Kanji unique to Level-5, studied by the end of 6th grade in
--   Japanese elementary schools.
fifth :: Set Char

-- | The Kanji unique to Level-4, studied during middle school in Japan.
fourth :: Set Char

-- | The Kanji unique to Level-3, studied by the end of middle school in
--   Japan.
third :: Set Char

-- | The Kanji unique to Level-Pre2, considerend "mid high school" level.
preSecond :: Set Char

-- | The Kanji unique to Level-2, considered "standard adult" level.
second :: Set Char


-- | Types for this library. While a constructor for <a>Kanji</a> is made
--   available here, you should prefer the <a>kanji</a> "smart constructor"
--   unless you know for sure that the <a>Char</a> in question falls within
--   the correct UTF8 range.
module Data.Kanji.Types

-- | A single symbol of Kanji. Japanese Kanji were borrowed from China over
--   several waves during the last 1,500 years. Japan names 2,136 of these
--   as their standard set, with rarer characters being the domain of
--   academia and esoteric writers.
--   
--   Japanese has several Japan-only Kanji, including:
--   
--   <ul>
--   <li>畑 (a type of rice field)</li>
--   <li>峠 (a narrow mountain pass)</li>
--   <li>働 (to do physical labour)</li>
--   </ul>
newtype Kanji
Kanji :: Char -> Kanji

-- | The original <a>Char</a> of a <a>Kanji</a>.
_kanji :: Kanji -> Char

-- | Construct a <a>Kanji</a> value from some <a>Char</a> if it falls in
--   the correct UTF8 range.
kanji :: Char -> Maybe Kanji

-- | A Level or <a>Kyuu</a> (級) 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 1,006 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 (2,136 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.
data Level
Ten :: Level
Nine :: Level
Eight :: Level
Seven :: Level
Six :: Level
Five :: Level
Four :: Level
Three :: Level
PreTwo :: Level
Two :: Level
PreOne :: Level
One :: Level
Unknown :: Level

-- | Legal Kanji appear between UTF-8 characters 19968 and 40959.
isKanji :: Char -> Bool

-- | あ to ん.
isHiragana :: Char -> Bool

-- | ア to ン.
isKatakana :: Char -> Bool

-- | General categories for characters, at least as is useful for thinking
--   about Japanese.
--   
--   Japanese "full-width" numbers and letters will be counted as
--   <a>Numeral</a> and <a>RomanLetter</a> respectively, alongside their
--   usual ASCII forms.
data CharCat
Hanzi :: CharCat
Hiragana :: CharCat
Katakana :: CharCat
Numeral :: CharCat
RomanLetter :: CharCat
Punctuation :: CharCat
Other :: CharCat
category :: Char -> CharCat
instance Data.Aeson.Types.FromJSON.FromJSON Data.Kanji.Types.CharCat
instance Data.Aeson.Types.ToJSON.ToJSON Data.Kanji.Types.CharCat
instance Control.DeepSeq.NFData Data.Kanji.Types.CharCat
instance Data.Hashable.Class.Hashable Data.Kanji.Types.CharCat
instance GHC.Generics.Generic Data.Kanji.Types.CharCat
instance GHC.Show.Show Data.Kanji.Types.CharCat
instance GHC.Classes.Ord Data.Kanji.Types.CharCat
instance GHC.Classes.Eq Data.Kanji.Types.CharCat
instance Data.Aeson.Types.FromJSON.FromJSON Data.Kanji.Types.Level
instance Data.Aeson.Types.ToJSON.ToJSON Data.Kanji.Types.Level
instance Control.DeepSeq.NFData Data.Kanji.Types.Level
instance Data.Hashable.Class.Hashable Data.Kanji.Types.Level
instance GHC.Generics.Generic Data.Kanji.Types.Level
instance GHC.Show.Show Data.Kanji.Types.Level
instance GHC.Enum.Enum Data.Kanji.Types.Level
instance GHC.Classes.Ord Data.Kanji.Types.Level
instance GHC.Classes.Eq Data.Kanji.Types.Level
instance Control.DeepSeq.NFData Data.Kanji.Types.Kanji
instance Data.Hashable.Class.Hashable Data.Kanji.Types.Kanji
instance Data.Aeson.Types.FromJSON.FromJSON Data.Kanji.Types.Kanji
instance Data.Aeson.Types.ToJSON.ToJSON Data.Kanji.Types.Kanji
instance GHC.Generics.Generic Data.Kanji.Types.Kanji
instance GHC.Show.Show Data.Kanji.Types.Kanji
instance GHC.Classes.Ord Data.Kanji.Types.Kanji
instance GHC.Classes.Eq Data.Kanji.Types.Kanji
instance Data.Aeson.Types.ToJSON.ToJSONKey Data.Kanji.Types.CharCat
instance Data.Aeson.Types.ToJSON.ToJSONKey Data.Kanji.Types.Level


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

-- | A single symbol of Kanji. Japanese Kanji were borrowed from China over
--   several waves during the last 1,500 years. Japan names 2,136 of these
--   as their standard set, with rarer characters being the domain of
--   academia and esoteric writers.
--   
--   Japanese has several Japan-only Kanji, including:
--   
--   <ul>
--   <li>畑 (a type of rice field)</li>
--   <li>峠 (a narrow mountain pass)</li>
--   <li>働 (to do physical labour)</li>
--   </ul>
data Kanji

-- | Construct a <a>Kanji</a> value from some <a>Char</a> if it falls in
--   the correct UTF8 range.
kanji :: Char -> Maybe Kanji

-- | The original <a>Char</a> of a <a>Kanji</a>.
_kanji :: Kanji -> Char

-- | All Japanese <a>Kanji</a>, grouped by their Level (級).
allKanji :: Map Level (Set Kanji)

-- | Legal Kanji appear between UTF-8 characters 19968 and 40959.
isKanji :: Char -> Bool

-- | あ to ん.
isHiragana :: Char -> Bool

-- | ア to ン.
isKatakana :: Char -> Bool

-- | General categories for characters, at least as is useful for thinking
--   about Japanese.
--   
--   Japanese "full-width" numbers and letters will be counted as
--   <a>Numeral</a> and <a>RomanLetter</a> respectively, alongside their
--   usual ASCII forms.
data CharCat
Hanzi :: CharCat
Hiragana :: CharCat
Katakana :: CharCat
Numeral :: CharCat
RomanLetter :: CharCat
Punctuation :: CharCat
Other :: CharCat
category :: Char -> CharCat

-- | A Level or <a>Kyuu</a> (級) 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 1,006 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 (2,136 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.
data Level
Ten :: Level
Nine :: Level
Eight :: Level
Seven :: Level
Six :: Level
Five :: Level
Four :: Level
Three :: Level
PreTwo :: Level
Two :: Level
PreOne :: Level
One :: Level
Unknown :: Level

-- | What <a>Level</a> does a Kanji belong to? <a>Unknown</a> for Kanji
--   above level <a>Two</a>.
level :: Kanji -> Level

-- | The distribution of each <a>Kanji</a> in a set of them. The
--   distribution values must sum to 1.
percentSpread :: [Kanji] -> Map Kanji Float

-- | How much of each <a>Level</a> is represented by a group of Kanji? The
--   distribution values will sum to 1.
levelDist :: [Kanji] -> Map Level Float

-- | Which Kanji appeared from each Level in the text?
uniques :: [Kanji] -> Map Level (Set Kanji)

-- | Percentage of appearance of each <a>CharCat</a> in the source text.
--   The percentages will sum to 1.0.
densities :: Text -> Map CharCat Float

-- | How much of the Kanji found are learnt in elementary school in Japan?
--   
--   <pre>
--   elementaryDen . levelDist :: [Kanji] -&gt; Float
--   </pre>
elementaryDen :: Map Level Float -> Float

-- | How much of the Kanji found are learnt by the end of middle school?
--   
--   <pre>
--   middleDen . levelDist :: [Kanji] -&gt; Float
--   </pre>
middleDen :: Map Level Float -> Float

-- | How much of the Kanji found are learnt by the end of high school?
--   
--   <pre>
--   highDen . levelDist :: [Kanji] -&gt; Float
--   </pre>
highDen :: Map Level Float -> Float
