packages feed

hist-pl-fusion 0.4.0 → 0.5.0

raw patch · 2 files changed

+19/−24 lines, 2 filesdep +hist-pl-dawgdep ~hist-pl-lexiconPVP ok

version bump matches the API change (PVP)

Dependencies added: hist-pl-dawg

Dependency ranges changed: hist-pl-lexicon

API changes (from Hackage documentation)

- NLP.HistPL.Fusion: baseDict :: Bila i a b -> BaseDict i a b
- NLP.HistPL.Fusion: formDict :: Bila i a b -> FormDict i a b
+ NLP.HistPL.Fusion: baseDAWG :: Bila i a b -> BaseDAWG i a b
+ NLP.HistPL.Fusion: formDAWG :: Bila i a b -> FormDAWG i a b
- NLP.HistPL.Fusion: Bila :: BaseDict i a b -> FormDict i a b -> Bila i a b
+ NLP.HistPL.Fusion: Bila :: BaseDAWG i a b -> FormDAWG i a b -> Bila i a b

Files

hist-pl-fusion.cabal view
@@ -1,5 +1,5 @@ name:               hist-pl-fusion-version:            0.4.0+version:            0.5.0 synopsis:           Merging historical dictionary with PoliMorf description:     The library provides functions for merging historical dictionary@@ -25,7 +25,8 @@       , text-binary       , dawg >= 0.9 && < 0.10       , polimorf >= 0.7.1 && < 0.8-      , hist-pl-lexicon >= 0.4 && < 0.5+      , hist-pl-dawg >= 0.1 && < 0.2+      , hist-pl-lexicon >= 0.5 && < 0.6      exposed-modules:         NLP.HistPL.Fusion@@ -35,11 +36,3 @@ source-repository head     type: git     location: https://github.com/kawu/hist-pl.git---- executable hist-pl-fuse---     build-depends:---         binary---       , cmdargs---     hs-source-dirs: src, tools---     main-is: hist-pl-fuse.hs---     ghc-options: -Wall -O2
src/NLP/HistPL/Fusion.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-} + module NLP.HistPL.Fusion ( -- * Basic types@@ -33,9 +34,10 @@ , sumChoice ) where -import Prelude hiding (lookup)-import Control.Applicative ((<$>), (<*>))-import Data.Text.Binary ()++import           Prelude hiding (lookup)+import           Control.Applicative ((<$>), (<*>))+import           Data.Text.Binary () import qualified Data.Map as M import qualified Data.Text as T import qualified Data.PoliMorf as P@@ -43,7 +45,7 @@ import           NLP.HistPL.Lexicon (UID) import qualified NLP.HistPL.Lexicon as H import qualified NLP.HistPL.Util as H-import           NLP.HistPL.Dict+import           NLP.HistPL.DAWG  ------------------------------------------------------------------------ @@ -67,13 +69,13 @@ -- | Dictionary keys represent base forms and rules transform base forms to -- their corresponding word forms.  Info @a@ is assigned to every lexeme -- and info @b@ to every word form.-type BaseDict i a b = Dict i a b+type BaseDAWG i a b = DAWG i a b   -- | Dictionary keys represent word forms and rules transform word forms to -- their corresponding base forms.  Info @a@ is assigned to every lexeme -- and info @b@ to every word form.-type FormDict i a b = Dict i a b+type FormDAWG i a b = DAWG i a b   ------------------------------------------------------------------------@@ -81,8 +83,8 @@  -- | Bilateral dictionary. data Bila i a b = Bila-    { baseDict  :: BaseDict i a b-    , formDict  :: FormDict i a b }+    { baseDAWG  :: BaseDAWG i a b+    , formDAWG  :: FormDAWG i a b }     deriving (Show, Eq, Ord)  @@ -90,18 +92,18 @@ -- lexeme info, word form, additional word form info) tuples. mkBila :: (Ord i, Ord a, Ord b) => [(Base, i, a, Word, b)] -> Bila i a b mkBila xs = Bila-    { baseDict  = baseDict'-    , formDict  = formDict' }+    { baseDAWG  = baseDAWG'+    , formDAWG  = formDAWG' }   where-    baseDict'   = fromList xs-    formDict'   = revDict baseDict'+    baseDAWG'   = fromList xs+    formDAWG'   = revDAWG baseDAWG'   -- | Identify entries which contain given word form. withForm :: Ord i => Bila i a b -> Word -> LexSet i a b withForm Bila{..} word = M.unions-    [ lookup base baseDict-    | let lexSet = lookup word formDict+    [ lookup base baseDAWG+    | let lexSet = lookup word formDAWG     , (_, val) <- M.assocs lexSet     , base <- M.keys (forms val) ]