crf-chain2-generic 0.1.0 → 0.1.1
raw patch · 4 files changed
+23/−10 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.CRF.Chain2.Generic.External: Word :: Set a -> Set b -> Word a b
- Data.CRF.Chain2.Generic.External: lbs :: Word a b -> Set b
- Data.CRF.Chain2.Generic.External: obs :: Word a b -> Set a
- Data.CRF.Chain2.Generic.Train: CodecSpc :: ([SentL a b] -> (c, [(Xs o t, Ys t)])) -> (c -> [SentL a b] -> [(Xs o t, Ys t)]) -> CodecSpc a b c o t
- Data.CRF.Chain2.Generic.Train: data CodecSpc a b c o t
+ Data.CRF.Chain2.Generic.Train: CodecSpec :: ([SentL a b] -> (c, [(Xs o t, Ys t)])) -> (c -> [SentL a b] -> [(Xs o t, Ys t)]) -> CodecSpec a b c o t
+ Data.CRF.Chain2.Generic.Train: data CodecSpec a b c o t
+ Data.CRF.Chain2.Pair: data Dist a
+ Data.CRF.Chain2.Pair: data Word a b
+ Data.CRF.Chain2.Pair: mkDist :: Ord a => [(a, Double)] -> Dist a
+ Data.CRF.Chain2.Pair: mkWord :: Set a -> Set b -> Word a b
+ Data.CRF.Chain2.Pair: type Sent a b = [Word a b]
+ Data.CRF.Chain2.Pair: type SentL a b = [WordL a b]
+ Data.CRF.Chain2.Pair: type WordL a b = (Word a b, Dist b)
- Data.CRF.Chain2.Generic.Train: encode :: CodecSpc a b c o t -> c -> [SentL a b] -> [(Xs o t, Ys t)]
+ Data.CRF.Chain2.Generic.Train: encode :: CodecSpec a b c o t -> c -> [SentL a b] -> [(Xs o t, Ys t)]
- Data.CRF.Chain2.Generic.Train: mkCodec :: CodecSpc a b c o t -> [SentL a b] -> (c, [(Xs o t, Ys t)])
+ Data.CRF.Chain2.Generic.Train: mkCodec :: CodecSpec a b c o t -> [SentL a b] -> (c, [(Xs o t, Ys t)])
- Data.CRF.Chain2.Generic.Train: train :: (Ord a, Ord b, Eq t, Ord f) => SgdArgs -> CodecSpc a b c o t -> FeatGen o t f -> IO [SentL a b] -> Maybe (IO [SentL a b]) -> IO (c, Model o t f)
+ Data.CRF.Chain2.Generic.Train: train :: (Ord a, Ord b, Eq t, Ord f) => SgdArgs -> CodecSpec a b c o t -> FeatGen o t f -> IO [SentL a b] -> Maybe (IO [SentL a b]) -> IO (c, Model o t f)
Files
- Data/CRF/Chain2/Generic/External.hs +1/−1
- Data/CRF/Chain2/Generic/Train.hs +4/−4
- Data/CRF/Chain2/Pair.hs +17/−4
- crf-chain2-generic.cabal +1/−1
Data/CRF/Chain2/Generic/External.hs view
@@ -1,5 +1,5 @@ module Data.CRF.Chain2.Generic.External-( Word (..)+( Word (obs, lbs) , mkWord , Sent , Dist (unDist)
Data/CRF/Chain2/Generic/Train.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE PatternGuards #-} module Data.CRF.Chain2.Generic.Train-( CodecSpc (..)+( CodecSpec (..) , train ) where @@ -19,7 +19,7 @@ import Data.CRF.Chain2.Generic.Inference (expectedFeatures, accuracy) -- | A codec specification.-data CodecSpc a b c o t = CodecSpc+data CodecSpec a b c o t = CodecSpec { mkCodec :: [SentL a b] -> (c, [(Xs o t, Ys t)]) , encode :: c -> [SentL a b] -> [(Xs o t, Ys t)] } @@ -31,12 +31,12 @@ train :: (Ord a, Ord b, Eq t, Ord f) => SGD.SgdArgs -- ^ Args for SGD- -> CodecSpc a b c o t -- ^ Codec specification+ -> CodecSpec a b c o t -- ^ Codec specification -> FeatGen o t f -- ^ Feature generation -> IO [SentL a b] -- ^ Training data 'IO' action -> Maybe (IO [SentL a b]) -- ^ Maybe evalation data -> IO (c, Model o t f) -- ^ Resulting codec and model-train sgdArgs CodecSpc{..} ftGen trainIO evalIO'Maybe = do+train sgdArgs CodecSpec{..} ftGen trainIO evalIO'Maybe = do hSetBuffering stdout NoBuffering (codec, trainData) <- mkCodec <$> trainIO evalDataM <- case evalIO'Maybe of
Data/CRF/Chain2/Pair.hs view
@@ -1,8 +1,21 @@ {-# LANGUAGE RecordWildCards #-} module Data.CRF.Chain2.Pair-( CRF (..)+( +-- * Data types+ Word (..)+, mkWord+, Sent+, Dist (unDist)+, mkDist+, WordL+, SentL++-- * CRF+, CRF (..)+-- ** Training , train+-- ** Tagging , tag ) where @@ -11,7 +24,7 @@ import qualified Numeric.SGD as SGD import Data.CRF.Chain2.Generic.Model (Model, core, withCore)-import Data.CRF.Chain2.Generic.External (SentL, Sent)+import Data.CRF.Chain2.Generic.External import qualified Data.CRF.Chain2.Generic.Inference as I import qualified Data.CRF.Chain2.Generic.Train as T @@ -29,8 +42,8 @@ _core <- get return $ withCore _core featGen -codecSpec :: (Ord a, Ord b, Ord c) => T.CodecSpc a (b, c) (Codec a b c) Ob Lb-codecSpec = T.CodecSpc+codecSpec :: (Ord a, Ord b, Ord c) => T.CodecSpec a (b, c) (Codec a b c) Ob Lb+codecSpec = T.CodecSpec { T.mkCodec = mkCodec , T.encode = encodeDataL }
crf-chain2-generic.cabal view
@@ -1,5 +1,5 @@ name: crf-chain2-generic-version: 0.1.0+version: 0.1.1 synopsis: Second-order, generic, constrained, linear conditional random fields description: The library provides implementation of the second-order, linear