module Data.CRF.Chain1.Constrained.DAG.Dataset.Codec
(
module Data.CRF.Chain1.Constrained.Dataset.Codec
, Xs
, XYs
, encodeSent'Cu
, encodeSent'Cn
, encodeSent
, encodeSentL'Cu
, encodeSentL'Cn
, encodeSentL
, encodeData
, encodeDataL
, mkCodec
) where
import Prelude hiding (Word)
import qualified Data.Traversable as T
import Data.DAG (DAG)
import qualified Data.CRF.Chain1.Constrained.Dataset.Internal as I
import Data.CRF.Chain1.Constrained.DAG.Dataset.External
import qualified Data.CRF.Chain1.Constrained.Dataset.Codec as C
import Data.CRF.Chain1.Constrained.Dataset.Codec hiding
(encodeSent'Cu, encodeSent'Cn, encodeSent, encodeSentL'Cu, encodeSentL'Cn,
encodeSentL, encodeData, encodeDataL, mkCodec)
import Control.Monad.Codec (evalCodec, execCodec)
type Xs = DAG () I.X
type XYs = DAG () (I.X, I.Y)
encodeSent'Cu :: (Ord a, Ord b) => Sent a b -> C.CodecM a b Xs
encodeSent'Cu = T.mapM C.encodeWord'Cu
encodeSent'Cn :: (Ord a, Ord b) => Sent a b -> C.CodecM a b Xs
encodeSent'Cn = T.mapM C.encodeWord'Cn
encodeSent :: (Ord a, Ord b) => C.Codec a b -> Sent a b -> Xs
encodeSent codec = evalCodec codec . encodeSent'Cn
encodeSentL'Cu :: (Ord a, Ord b) => SentL a b -> C.CodecM a b XYs
encodeSentL'Cu = T.mapM C.encodeWordL'Cu
encodeSentL'Cn :: (Ord a, Ord b) => SentL a b -> C.CodecM a b XYs
encodeSentL'Cn = T.mapM C.encodeWordL'Cn
encodeSentL :: (Ord a, Ord b) => C.Codec a b -> SentL a b -> XYs
encodeSentL codec = evalCodec codec . encodeSentL'Cn
encodeDataL :: (Ord a, Ord b) => C.Codec a b -> [SentL a b] -> [XYs]
encodeDataL = map . encodeSentL
encodeData :: (Ord a, Ord b) => C.Codec a b -> [Sent a b] -> [Xs]
encodeData = map . encodeSent
mkCodec :: (Ord a, Ord b) => [SentL a b] -> Codec a b
mkCodec = execCodec empty . mapM_ encodeSentL'Cu