| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Text.Seonbi.Facade
Description
Provides higher-level APIs. Read transformHtmlText function first,
and then see also Configuration type.
Synopsis
- transformHtmlText :: forall (m :: Type -> Type) a. (Monad m, MonadFail m) => Configuration m a -> Text -> m Text
- transformHtmlLazyText :: forall (m :: Type -> Type) a. (Monad m, MonadFail m) => Configuration m a -> Text -> m Text
- data Monad m => Configuration m a = Configuration {
- debugLogger :: Maybe (HtmlEntity -> m a)
- contentType :: ContentType
- quote :: Maybe QuoteOption
- cite :: Maybe CiteOption
- arrow :: Maybe ArrowOption
- ellipsis :: Bool
- emDash :: Bool
- stop :: Maybe StopOption
- hanja :: Maybe HanjaOption
- ko_KP :: Monad m => Configuration m a
- ko_KR :: Monad m => Configuration m a
- presets :: (Ord k, IsString k, Monad m) => Map k (Configuration m a)
- type ContentType = MediaType
- contentTypeFromText :: Text -> Maybe ContentType
- contentTypes :: Set ContentType
- contentTypeText :: ContentType -> Text
- type HanjaDictionary = Trie Text
- readDictionaryFile :: FilePath -> IO HanjaDictionary
- southKoreanDictionary :: IO HanjaDictionary
- data ArrowOption = ArrowOption {
- bidirArrow :: Bool
- doubleArrow :: Bool
- data CiteOption
- data HanjaOption = HanjaOption {}
- data HanjaReadingOption = HanjaReadingOption {}
- data HanjaRenderingOption
- data QuoteOption
- data StopOption
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 #
Constructors
| Configuration | |
Fields
| |
Instances
| Monad m => Show (Configuration m a) Source # | |
Defined in Text.Seonbi.Facade Methods showsPrec :: Int -> Configuration m a -> ShowS # show :: Configuration m a -> String # showList :: [Configuration m a] -> ShowS # | |
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.
contentTypeFromText :: Text -> Maybe ContentType Source #
Converts a Text to a ContentType.
contentTypes :: Set ContentType Source #
Supported content types.
contentTypeText :: ContentType -> Text Source #
Converts a ContentType to a Text.
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.
southKoreanDictionary :: IO HanjaDictionary Source #
Loads Standard Korean Language Dictionary (標準國語大辭典) data.
Options
data ArrowOption Source #
Settings to transform arrow-looking punctuations into proper arrows.
Constructors
| ArrowOption | |
Fields
| |
Instances
| Generic ArrowOption Source # | |
Defined in Text.Seonbi.Facade Associated Types type Rep ArrowOption :: Type -> Type # | |
| Show ArrowOption Source # | |
Defined in Text.Seonbi.Facade Methods showsPrec :: Int -> ArrowOption -> ShowS # show :: ArrowOption -> String # showList :: [ArrowOption] -> ShowS # | |
| Eq ArrowOption Source # | |
Defined in Text.Seonbi.Facade | |
| type Rep ArrowOption Source # | |
Defined in Text.Seonbi.Facade type Rep ArrowOption = D1 ('MetaData "ArrowOption" "Text.Seonbi.Facade" "seonbi-0.6.0-KiRYrqfC33pEp2D2DXrXvy" '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 |
| CornerBracketsWithCite | Same as |
Instances
data HanjaOption Source #
Settings to deal with Sino-Korean words.
Constructors
| HanjaOption | |
Fields
| |
Instances
| Show HanjaOption Source # | |
Defined in Text.Seonbi.Facade Methods showsPrec :: Int -> HanjaOption -> ShowS # show :: HanjaOption -> String # showList :: [HanjaOption] -> ShowS # | |
data HanjaReadingOption Source #
Settings to read Sino-Korean words.
Constructors
| HanjaReadingOption | |
Fields
| |
Instances
| Show HanjaReadingOption Source # | |
Defined in Text.Seonbi.Facade Methods showsPrec :: Int -> HanjaReadingOption -> ShowS # show :: HanjaReadingOption -> String # showList :: [HanjaReadingOption] -> ShowS # | |
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., |
| HanjaInRuby | Renders a word in Please read Use Cases & Exploratory Approaches for Ruby Markup as well for more information. |
Instances
data QuoteOption Source #
An option to decide how quotation marks are rendered.
Constructors
| CurvedQuotes | English-style curved quotes ( |
| VerticalCornerBrackets | Vertical corner brackets ( |
| HorizontalCornerBrackets | Traditional horizontal corner brackets ( |
| Guillemets | East Asian guillemets ( |
| CurvedSingleQuotesWithQ | Use English-style curved quotes ( |
| VerticalCornerBracketsWithQ | Use vertical corner brackets ( |
| HorizontalCornerBracketsWithQ | Use horizontal corner brackets ( |
Instances
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 봄/여름/가을/겨울. 어제, 오늘. |
| Vertical | Stop sentences in the pre-modern Korean style which follows Chinese stops. E.g.: 봄·여름·가을·겨울。어제、오늘。 |