| Copyright | (c) Matthew Mosior 2022 |
|---|---|
| License | BSD-style |
| Maintainer | mattm.github@gmail.com |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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
- bytestringToBWTToMTFB :: ByteString -> MTFB
- bytestringToBWTToMTFT :: ByteString -> MTFT
- textToBWTToMTFB :: Text -> MTFB
- textToBWTToMTFT :: Text -> MTFT
- textBWTToMTFB :: TextBWT -> MTFB
- bytestringBWTToMTFB :: BWT Word8 -> MTFB
- textBWTToMTFT :: TextBWT -> MTFT
- bytestringBWTToMTFT :: BWT Word8 -> MTFT
- textToMTFB :: Seq (Maybe Text) -> MTFB
- bytestringToMTFB :: Seq (Maybe ByteString) -> MTFB
- textToMTFT :: Seq (Maybe Text) -> MTFT
- bytestringToMTFT :: Seq (Maybe ByteString) -> MTFT
- bytestringFromBWTFromMTFB :: MTFB -> ByteString
- bytestringFromBWTFromMTFT :: MTFT -> ByteString
- textFromBWTFromMTFB :: MTFB -> Text
- textFromBWTFromMTFT :: MTFT -> Text
- textBWTFromMTFT :: MTFT -> BWT Text
- bytestringBWTFromMTFT :: MTFT -> BWT ByteString
- textBWTFromMTFB :: MTFB -> BWT Text
- bytestringBWTFromMTFB :: MTFB -> BWT ByteString
- textFromMTFB :: MTFB -> Seq (Maybe Text)
- bytestringFromMTFB :: MTFB -> Seq (Maybe ByteString)
- textFromMTFT :: MTFT -> Seq (Maybe Text)
- bytestringFromMTFT :: MTFT -> Seq (Maybe ByteString)
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 #
textToBWTToMTFT :: Text -> MTFT Source #
textBWTToMTFB :: TextBWT -> MTFB Source #
textBWTToMTFT :: TextBWT -> MTFT Source #
bytestringToMTFB :: Seq (Maybe ByteString) -> MTFB Source #
Takes a Seq of ByteStrings and returns the Move-to-front transform (MTFB).
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 #
textFromBWTFromMTFT :: MTFT -> Text Source #
bytestringBWTFromMTFT :: MTFT -> BWT ByteString Source #
Takes a MTFT and returns
the BWT of ByteStrings.
bytestringBWTFromMTFB :: MTFB -> BWT ByteString Source #
Take a MTFB and returns
the BWT of ByteStrings.
bytestringFromMTFB :: MTFB -> Seq (Maybe ByteString) Source #
Takes a MTFB and returns
the original Seq of ByteStrings.
bytestringFromMTFT :: MTFT -> Seq (Maybe ByteString) Source #
Takes a MTFT and returns
the original Seq of ByteStrings.