text-compression-0.1.0.25: A text compression library.
Copyright(c) Matthew Mosior 2022
LicenseBSD-style
Maintainermattm.github@gmail.com
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.MTF

Description

Move-to-front transform (MTF)

Users will get the most mileage by first compressing to a BWT on the initial ByteString or Text input before compressing to a MTFB or MTFT.

To do this, users can use the bytestringToBWTToMTFB and bytestringToBWTToMTFT functions, as well as the textToBWTToMTFB and textToBWTToMTFT functions.

The base functions for ByteString, bytestringToMTFB and bytestringToMTFT can be used to convert a Seq (Maybe ByteString) to a MTFB and MTFT, respectively.

Likewise, the base functions for Text, textToMTFB and textToMTFT can be used to convert a Seq (Maybe Text) to a MTFB and MTFT respectively.

There are various other lower-level functions for interacting with the MTF implementation on ByteString and Text as well.

Data.MTF.Internal contains efficient and stateful implementations of the MTF and Inverse MTF algorithms.

Synopsis

To MTF functions

bytestringToBWTToMTFB :: ByteString -> MTFB Source #

Helper function for converting a ByteString to a MTFB via a BWT first.

bytestringToBWTToMTFT :: ByteString -> MTFT Source #

Helper function for converting a ByteString to a MTFT via a BWT first.

textToBWTToMTFB :: Text -> MTFB Source #

Helper function for converting a Text to a MTFB via a BWT first.

textToBWTToMTFT :: Text -> MTFT Source #

Helper function for converting a Text to a MTFT via a BWT first.

textBWTToMTFB :: TextBWT -> MTFB Source #

Take a BWT of Word8s and generate the Move-to-front transform (MTFB).

bytestringBWTToMTFB :: BWT Word8 -> MTFB Source #

Take a BWT of Word8s and generate the Move-to-front transform (MTFB).

textBWTToMTFT :: TextBWT -> MTFT Source #

Take a BWT of Word8s and generate the Move-to-front transform (MTFB).

bytestringBWTToMTFT :: BWT Word8 -> MTFT Source #

Take a BWT of Word8s and generate the Move-to-front transform (MTFT).

textToMTFB :: Seq (Maybe Text) -> MTFB Source #

Takes a Text and returns the Move-to-front transform (MTFB).

bytestringToMTFB :: Seq (Maybe ByteString) -> MTFB Source #

Takes a Seq of ByteStrings and returns the Move-to-front transform (MTFB).

textToMTFT :: Seq (Maybe Text) -> MTFT Source #

Takes a Text and returns the Move-to-front transform (MTFT).

bytestringToMTFT :: Seq (Maybe ByteString) -> MTFT Source #

Takes a ByteString and returns the Move-to-front transform (MTFT).

From MTF functions

bytestringFromBWTFromMTFB :: MTFB -> ByteString Source #

Helper function for converting a BWTed MTFB back to the original ByteString.

bytestringFromBWTFromMTFT :: MTFT -> ByteString Source #

Helper function for converting a BWTed MTFT back to the original ByteString.

textFromBWTFromMTFB :: MTFB -> Text Source #

Helper function for converting a BWTed MTFB back to the original Text.

textFromBWTFromMTFT :: MTFT -> Text Source #

Helper function for converting a BWTed MTFT back to the original Text.

textBWTFromMTFT :: MTFT -> BWT Text Source #

Takes a MTFT and returns the BWT of Texts.

bytestringBWTFromMTFT :: MTFT -> BWT ByteString Source #

Takes a MTFT and returns the BWT of ByteStrings.

textBWTFromMTFB :: MTFB -> BWT Text Source #

Takes a MTFB and returns the BWT of Texts.

textFromMTFB :: MTFB -> Seq (Maybe Text) Source #

Takes a MTFB and returns the original Seq of Texts.

bytestringFromMTFB :: MTFB -> Seq (Maybe ByteString) Source #

Takes a MTFB and returns the original Seq of ByteStrings.

textFromMTFT :: MTFT -> Seq (Maybe Text) Source #

Takes a MTFT and returns the original Seq of Texts.

bytestringFromMTFT :: MTFT -> Seq (Maybe ByteString) Source #

Takes a MTFT and returns the original Seq of ByteStrings.