packages feed

hist-pl 0.2.0 → 0.2.1

raw patch · 3 files changed

+22/−12 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ NLP.HistPL.Analyse: showDefs :: JConf -> Bool
- NLP.HistPL.Analyse: JConf :: ShowCont -> JConf
+ NLP.HistPL.Analyse: JConf :: ShowCont -> Bool -> JConf

Files

hist-pl.cabal view
@@ -1,5 +1,5 @@ name:               hist-pl-version:            0.2.0+version:            0.2.1 synopsis:           Umbrella package for the historical dictionary of Polish description:     The package provides a tool for creating and searching the
src/NLP/HistPL/Analyse.hs view
@@ -133,14 +133,18 @@ -- | JSON serialization configuration.  Depending on the configuration, -- different parts of the result will be converted to a JSON format. data JConf = JConf-    { showCont :: ShowCont }-    deriving (Show, Eq, Ord)+    { showCont  :: ShowCont+    -- ^ When to show cont. interpretations.+    , showDefs  :: Bool+    -- ^ Show definitions?+    } deriving (Show, Eq, Ord)   -- | Default JSON serialization configuration. defaultJConf :: JConf defaultJConf = JConf-    { showCont = ShowCont }+    { showCont  = ShowCont+    , showDefs  = False }   -- | Build JSON value from a list of analysed sentences.@@ -175,16 +179,19 @@  -- | JSON represesentation of a historical interpretation. jsonHist :: JConf -> (H.LexEntry, H.Code) -> Value-jsonHist jc (entry, code) = object-    [ "id"    .= jsonID (H.lexId entry, code)-    , "pos"   .= map toJSON (H.pos entry)-    , "base"  .= map toJSON (H.text $ H.lemma entry) ]+jsonHist jc (entry, code) = object $+    [ "id"   .= jsonID (H.lexId entry, code)+    , "pos"  .= H.pos entry+    , "base" .= H.text (H.lemma entry) ]+    ++ if showDefs jc then [defsElem] else []   where     jsonID (id', cd') = toJSON (toJSON id', jsonCode cd')     jsonCode code' = toJSON $ case code' of         H.Orig -> "orig" :: T.Text         H.Both -> "both"         H.Copy -> "copy"+    defsElem = "defs" .= concatMap H.text (getDefs entry)+    getDefs  = concatMap H.defs . H.senses   -- | JSON represesentation of a contemporary interpretation.
tools/hist-pl.hs view
@@ -51,7 +51,8 @@     , transFlag     :: Bool     , rmHypFlag     :: Bool     , compact       :: Bool-    , printCont     :: Int }+    , printCont     :: Int+    , printDefs     :: Bool }   deriving (Data, Typeable, Show)  @@ -79,7 +80,8 @@     , compact = False &= help "Compact JSON output"     , printCont = 1 &= (help . unwords)         [ "Printing contemporary interpretations:"-        , "0 -- never, 1 -- when no hist (default), 2 -- always" ] }+        , "0 -- never, 1 -- when no hist (default), 2 -- always" ]+    , printDefs = False &= help "Print definitions" }   argModes :: Mode (CmdArgs HistPL)@@ -130,7 +132,7 @@     rmHyp | rmHypFlag = A.rmHyphen           | otherwise = id     onLine hpl-        = fmap (encode . A.jsonAna A.defaultJConf)+        = fmap (encode . A.jsonAna jsonConf)         . A.mapL (A.anaWord hpl . trans)         . A.tokenize . L.toStrict     trans   | transFlag = T.pack . I.transliter I.impactRules . T.unpack@@ -141,4 +143,5 @@         { A.showCont = case printCont of             0   -> A.NoShowCont             2   -> A.ForceShowCont-            _   -> A.ShowCont }+            _   -> A.ShowCont+        , A.showDefs = printDefs }