concraft-pl 0.5.0 → 0.6.0
raw patch · 4 files changed
+21/−25 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- NLP.Concraft.Polish.Morphosyntax: Interp :: Maybe Text -> t -> Interp t
+ NLP.Concraft.Polish.Morphosyntax: Interp :: Text -> t -> Interp t
- NLP.Concraft.Polish.Morphosyntax: base :: Interp t -> Maybe Text
+ NLP.Concraft.Polish.Morphosyntax: base :: Interp t -> Text
Files
- changelog +3/−0
- concraft-pl.cabal +1/−1
- src/NLP/Concraft/Polish/Format/Plain.hs +13/−20
- src/NLP/Concraft/Polish/Morphosyntax.hs +4/−4
changelog view
@@ -1,4 +1,7 @@ -*-change-log-*- +0.6.0 Nov 2013+ * Output wordform instead of "None" as a lemma for unknown words+ 0.5.0 Nov 2013 * Restore the orth[-2] feature in the observation schema
concraft-pl.cabal view
@@ -1,5 +1,5 @@ name: concraft-pl-version: 0.5.0+version: 0.6.0 synopsis: Morphological tagger for Polish description: A morphological tagger for Polish based on the concraft library.
src/NLP/Concraft/Polish/Format/Plain.hs view
@@ -31,9 +31,6 @@ import NLP.Concraft.Polish.Morphosyntax -noneBase :: T.Text-noneBase = "None"- -- | Parse the text in the plain format. parsePlain :: L.Text -> [[Sent Tag]] parsePlain =@@ -85,24 +82,20 @@ doIt [form, tag, "disamb"] = Just $ (mkInterp form tag, True) doIt xs = error $ "parseInterp: " ++ show xs- mkInterp form tag- | formS == noneBase = Interp Nothing tagS- | otherwise = Interp (Just formS) tagS- where- formS = L.toStrict form- tagS = L.toStrict tag+ mkInterp form tag = Interp (L.toStrict form) (L.toStrict tag) parseHeader :: L.Text -> (T.Text, Space) parseHeader xs = let [_orth, space] = L.splitOn "\t" xs in (L.toStrict _orth, parseSpace space) +-- TODO: Should we represent newlines and spaces in the `Space` data type? parseSpace :: L.Text -> Space parseSpace "none" = None parseSpace "space" = Space-parseSpace "spaces" = Space -- Is it not a Maca bug?+parseSpace "spaces" = Space -- Multiple spaces parseSpace "newline" = NewLine-parseSpace "newlines" = NewLine -- TODO: Remove this temporary fix+parseSpace "newlines" = NewLine -- Multiple newlines parseSpace xs = error ("parseSpace: " ++ L.unpack xs) -----------@@ -129,7 +122,7 @@ buildWord Seg{..} = L.fromText orth <> "\t" <> buildSpace space <> "\n"- <> buildKnown known+ <> buildKnown orth known <> buildInterps (M.toList interps) where Word{..} = word @@ -142,20 +135,20 @@ else "\n" | (interp, dmb) <- interps ] where- buildTag = L.fromText . tag- buildBase x = case base x of- Just b -> L.fromText b- Nothing -> L.fromText noneBase+ buildTag = L.fromText . tag+ buildBase = L.fromText . base buildSpace :: Space -> L.Builder buildSpace None = "none" buildSpace Space = "space" buildSpace NewLine = "newline" -buildKnown :: Bool -> L.Builder-buildKnown True = ""-buildKnown False = "\t" <> L.fromText noneBase- <> "\t" <> L.fromText ign <> "\n"+buildKnown :: T.Text -> Bool -> L.Builder+buildKnown _ True = ""+buildKnown lemma False+ = "\t" <> L.fromText lemma+ <> "\t" <> L.fromText ign+ <> "\n" -----------
src/NLP/Concraft/Polish/Morphosyntax.hs view
@@ -103,9 +103,8 @@ -- | A morphosyntactic interpretation.--- TODO: Should we allow `base` to be `Nothing`? data Interp t = Interp- { base :: Maybe T.Text+ { base :: T.Text , tag :: t } deriving (Show, Eq, Ord) @@ -173,8 +172,9 @@ ++ catMaybes [ if tag `M.member` wSet seg then Nothing- else Just (Interp Nothing tag, asDmb x)- | (tag, x) <- M.toList (X.unWMap wMap) ]+ else Just (Interp lemma tag, asDmb x)+ | let lemma = orth $ word seg -- Default base form+ , (tag, x) <- M.toList (X.unWMap wMap) ] --------------------------------