seonbi-0.5.0: SmartyPants for Korean language
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Seonbi.Facade

Description

Provides higher-level APIs. Read transformHtmlText function first, and then see also Configuration type.

Synopsis

HTML transformation

transformHtmlText :: forall (m :: Type -> Type) a. (Monad m, MonadFail m) => Configuration m a -> Text -> m Text Source #

Transforms a given text. Nothing if it fails to parse the given text.

transformHtmlLazyText :: forall (m :: Type -> Type) a. (Monad m, MonadFail m) => Configuration m a -> Text -> m Text Source #

A lazy version of transformHtmlText function.

Configuration and presets

data Monad m => Configuration m a Source #

Transformation settings. For the most cases, you could use one of presets:

Constructors

Configuration 

Fields

Instances

Instances details
Monad m => Show (Configuration m a) Source # 
Instance details

Defined in Text.Seonbi.Facade

ko_KP :: Monad m => Configuration m a Source #

Preset Configuration for North Korean orthography.

ko_KR :: Monad m => Configuration m a Source #

Preset Configuration for South Korean orthography.

presets :: (Ord k, IsString k, Monad m) => Map k (Configuration m a) Source #

A mapping of locale code strings (e.g., "ko-kr") to the corresponding Configuration presets (e.g., ko_KR).

Content types

type ContentType = MediaType Source #

Represents a case-insensitive content type.

contentTypes :: Set ContentType Source #

Supported content types.

Dictionaries

type HanjaDictionary = Trie Text Source #

Represents a dictionary that has hanja keys and values of their corresponding hangul readings, e.g., [("敗北", "패배")].

readDictionaryFile :: FilePath -> IO HanjaDictionary Source #

Loads a dictionary file. The file consists of two-column TSV (tab-separated values); the first column is hanja and the second column is hangul.

Options

data ArrowOption Source #

Settings to transform arrow-looking punctuations into proper arrows.

Constructors

ArrowOption 

Fields

  • bidirArrow :: Bool

    Whether to transform bi-directional arrows as well as left/rightwards arrows.

  • doubleArrow :: Bool

    Whether to transform double arrows as well as single arrows.

Instances

Instances details
Generic ArrowOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Associated Types

type Rep ArrowOption :: Type -> Type #

Show ArrowOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Eq ArrowOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep ArrowOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep ArrowOption = D1 ('MetaData "ArrowOption" "Text.Seonbi.Facade" "seonbi-0.5.0-K1nG4vuiRoa9BoZqVCW3eo" 'False) (C1 ('MetaCons "ArrowOption" 'PrefixI 'True) (S1 ('MetaSel ('Just "bidirArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "doubleArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))

data CiteOption Source #

An option to transform folk-citing quotes (e.g., <<한겨레>>) into proper citing quotes (e.g., 《한겨레》).

Constructors

AngleQuotes

Cite a title using angle quotes, used by South Korean orthography in horizontal writing (橫書), e.g., 《나비와 엉겅퀴》 or 〈枾崎의 바다〉.

CornerBrackets

Cite a title using corner brackets, used by South Korean orthography in vertical writing (縱書) and Japanese orthography, e.g., 『나비와 엉겅퀴』 or 「枾崎의 바다」.

AngleQuotesWithCite

Same as AngleQuotes except it wraps the title with a <cite> tag.

CornerBracketsWithCite

Same as CornerBrackets except it wraps the title with a <cite> tag.

Instances

Instances details
Enum CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Generic CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Associated Types

type Rep CiteOption :: Type -> Type #

Read CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Show CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Eq CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep CiteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep CiteOption = D1 ('MetaData "CiteOption" "Text.Seonbi.Facade" "seonbi-0.5.0-K1nG4vuiRoa9BoZqVCW3eo" 'False) ((C1 ('MetaCons "AngleQuotes" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CornerBrackets" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "AngleQuotesWithCite" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CornerBracketsWithCite" 'PrefixI 'False) (U1 :: Type -> Type)))

data HanjaOption Source #

Settings to deal with Sino-Korean words.

Constructors

HanjaOption 

Fields

Instances

Instances details
Show HanjaOption Source # 
Instance details

Defined in Text.Seonbi.Facade

data HanjaReadingOption Source #

Settings to read Sino-Korean words.

Constructors

HanjaReadingOption 

Fields

  • initialSoundLaw :: Bool

    Whether to apply Initial Sound Law (頭音法則) or not.

  • dictionary :: HanjaDictionary

    A dictionary which has hanja readings. Keys are hanja words and values are their corresponding hangul readings, e.g.:

    [("敗北", "패배"), ("北極", "북극")] :: HanjaDictionary

Instances

Instances details
Show HanjaReadingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

data HanjaRenderingOption Source #

Available options to render Sino-Korean words.

Constructors

HangulOnly

Renders a word in hangul-only, no hanja at all (e.g., 안녕히).

HanjaInParentheses

Renders a word in hangul followed by hanja in parentheses (e.g., 안녕(安寧)히).

DisambiguatingHanjaInParentheses

Renders words in hangul-only for the most part, and if there are homophones in a document put their hanja notation in parentheses (e.g., 안녕히 or 소수(小數)와 소수(素數)).

HanjaInRuby

Renders a word in ruby tag (e.g., <ruby>安寧<rp>(</rp><rt>안녕</rt><rp>)</rp></ruby>히).

Please read Use Cases & Exploratory Approaches for Ruby Markup as well for more information.

Instances

Instances details
Enum HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Generic HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Associated Types

type Rep HanjaRenderingOption :: Type -> Type #

Read HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Show HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Eq HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep HanjaRenderingOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep HanjaRenderingOption = D1 ('MetaData "HanjaRenderingOption" "Text.Seonbi.Facade" "seonbi-0.5.0-K1nG4vuiRoa9BoZqVCW3eo" 'False) ((C1 ('MetaCons "HangulOnly" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HanjaInParentheses" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DisambiguatingHanjaInParentheses" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HanjaInRuby" 'PrefixI 'False) (U1 :: Type -> Type)))

data QuoteOption Source #

An option to decide how quotation marks are rendered.

Constructors

CurvedQuotes

English-style curved quotes (: U+2018, : U+2019, : U+201C, : U+201D), which are used by South Korean orthography.

VerticalCornerBrackets

Vertical corner brackets (: U+FE41, : U+FE42, : U+FE43, : U+FE44), which are used by East Asian orthography.

HorizontalCornerBrackets

Traditional horizontal corner brackets (: U+300C, : U+300D, : U+300E, : U+300F), which are used by East Asian orthography.

Guillemets

East Asian guillemets (: U+3008, : U+3009, : U+300A, : U+300B), which are used by North Korean orthography.

CurvedSingleQuotesWithQ

Use English-style curved quotes (: U+2018, : U+2019) for single quotes, and HTML <q> tags for double quotes.

VerticalCornerBracketsWithQ

Use vertical corner brackets (: U+FE41, : U+FE42) for single quotes, and HTML <q> tags for double quotes.

HorizontalCornerBracketsWithQ

Use horizontal corner brackets (: U+300C, : U+300D) for single quotes, and HTML <q> tags for double quotes.

Instances

Instances details
Enum QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Generic QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Associated Types

type Rep QuoteOption :: Type -> Type #

Read QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Show QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Eq QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep QuoteOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep QuoteOption = D1 ('MetaData "QuoteOption" "Text.Seonbi.Facade" "seonbi-0.5.0-K1nG4vuiRoa9BoZqVCW3eo" 'False) ((C1 ('MetaCons "CurvedQuotes" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "VerticalCornerBrackets" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HorizontalCornerBrackets" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Guillemets" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CurvedSingleQuotesWithQ" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "VerticalCornerBracketsWithQ" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HorizontalCornerBracketsWithQ" 'PrefixI 'False) (U1 :: Type -> Type))))

data StopOption Source #

Settings to normalize stops (periods, commas, and interpuncts) in docs.

Constructors

Horizontal

Stop sentences in the modern Korean style which follows Western stops. E.g.:

봄·여름·가을·겨울. 어제, 오늘.
HorizontalWithSlashes

Similar to horizontalStops except slashes are used instead of interpuncts. E.g.:

봄/여름/가을/겨울. 어제, 오늘.
Vertical

Stop sentences in the pre-modern Korean style which follows Chinese stops. E.g.:

봄·여름·가을·겨울。어제、오늘。

Instances

Instances details
Enum StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Generic StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Associated Types

type Rep StopOption :: Type -> Type #

Read StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Show StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

Eq StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep StopOption Source # 
Instance details

Defined in Text.Seonbi.Facade

type Rep StopOption = D1 ('MetaData "StopOption" "Text.Seonbi.Facade" "seonbi-0.5.0-K1nG4vuiRoa9BoZqVCW3eo" 'False) (C1 ('MetaCons "Horizontal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "HorizontalWithSlashes" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Vertical" 'PrefixI 'False) (U1 :: Type -> Type)))