From e12cd6464e46e891610266c1d0be035029952728 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 15 Sep 2026 10:39:25 +0200 Subject: [PATCH] implement morphoMissing, morphoKnown --- src/runtime/haskell/PGF.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index e8cfbfb46..b8fd025be 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -107,7 +107,8 @@ module PGF( -- ** Morphological Analysis Lemma, Analysis, Morpho, - lookupMorpho, buildMorpho, fullFormLexicon, + lookupMorpho, buildMorpho, morphoMissing, morphoKnown, + fullFormLexicon, -- ** Visualizations graphvizAbstractTree, @@ -660,6 +661,16 @@ lookupMorpho :: Morpho -> String -> [(Lemma,Analysis)] lookupMorpho (Morpho cnc) s = [(CId fun,an) | (fun,an,_) <- PGF2.lookupMorpho cnc s] +morphoMissing :: Morpho -> [String] -> [String] +morphoMissing = morphoClassify False + +morphoKnown :: Morpho -> [String] -> [String] +morphoKnown = morphoClassify True + +morphoClassify :: Bool -> Morpho -> [String] -> [String] +morphoClassify k mo ws = [w | w <- ws, k /= null (lookupMorpho mo w), notLiteral w] where + notLiteral w = not (all isDigit w) ---- should be defined somewhere + fullFormLexicon :: Morpho -> [(String,[(Lemma,Analysis)])] fullFormLexicon (Morpho cnc) = [(w,[(CId fun,an) | (fun,an,_) <- ans]) | (w,ans) <- PGF2.fullFormLexicon cnc]