implement morphoMissing, morphoKnown

This commit is contained in:
Krasimir Angelov
2026-09-15 10:39:25 +02:00
parent 880f1cd83d
commit e12cd6464e
+12 -1
View File
@@ -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]