concraft-pl 0.7.3 → 0.7.4
raw patch · 3 files changed
+21/−14 lines, 3 filesdep ~aesondep ~mtldep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, mtl, text, transformers
API changes (from Hackage documentation)
Files
- changelog +3/−0
- concraft-pl.cabal +5/−5
- src/NLP/Concraft/Polish/Maca.hs +13/−9
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +0.7.4 Nov 2014+ * Ignore non-printable characters for compatibility with Maca+ 0.7.0 Nov 2013 * Output guessing results for unknown words * Allow "--noana" option in the client/server mode
concraft-pl.cabal view
@@ -1,5 +1,5 @@ name: concraft-pl-version: 0.7.3+version: 0.7.4 synopsis: Morphological tagger for Polish description: A morphological tagger for Polish based on the concraft library.@@ -28,12 +28,12 @@ , sgd >= 0.3.3 && < 0.4 , containers >= 0.4 && < 0.6 , bytestring >= 0.9 && < 0.11- , text >= 0.11 && < 1.2- , aeson >= 0.6 && < 0.8+ , text >= 0.11 && < 1.3+ , aeson >= 0.6 && < 0.9 , binary >= 0.5 && < 0.8 , process >= 1.1 && < 1.3- , mtl >= 2.0 && < 2.2- , transformers >= 0.2 && < 0.4+ , mtl >= 2.0 && < 2.3+ , transformers >= 0.2 && < 0.5 , network >= 2.3 && < 2.7 , lazy-io >= 0.1 && < 0.2 , split >= 0.2 && < 0.3
src/NLP/Concraft/Polish/Maca.hs view
@@ -213,29 +213,33 @@ putMaca x (MacaPool c) = writeChan c x --- | Analyse paragraph with Maca.--- The function is thread-safe.+-- | Analyse paragraph with Maca. The function is thread-safe. As a+-- pre-processing step, all non-printable characters are removed from+-- the input (based on empirical observations, Maca behaves likewise). macaPar :: MacaPool -> T.Text -> IO [Sent Tag]-macaPar pool par = do+macaPar pool par0 = do+ let par = T.filter C.isPrint par0 maca <- popMaca pool doMacaPar maca par `finally` putMaca maca pool -------------------------------- Weight-----------------------------+------------------------------------------------------------+-- Weight: a number of non-space characters+------------------------------------------------------------ --- | A number of non-space characters in a text.+-- | A weight of a text. textWeight :: T.Text -> Int+-- textWeight = T.length . T.filter C.isAlphaNum textWeight = T.length . T.filter (not . C.isSpace)+-- textWeight = T.length . T.filter ((&&) <$> not . C.isSpace <*> C.isPrint) --- | A number of non-space characters in a sentence.+-- | A weight of a segment. segWeight :: Seg t -> Int segWeight = textWeight . orth . word --- | A number of non-space characters in a sentence.+-- | A weight of a sentence. sentWeight :: Sent t -> Int sentWeight = sum . map segWeight