polish: complete the RGL enough to build an application grammar

Adding Polish to informath (grammars/next) exposed a set of gaps. Unlike
Czech, StructuralPol was already complete; what was missing was a handful
of lins, a way to govern the nominative, and some outright mistakes.

Missing lins, all reached as qualified Grammar.X by the application's
functors and so not shimmable from the application side:

  AdjectivePol  AdvAP
  SentencePol   SSubjS
  IdiomPol      ImpP3
  StructuralPol that_Subj
  MarkupPol     new module (Markup is not part of the RGL build script,
                so it is compiled on demand, as MarkupCze is)
  ParadigmsPol  mkAdv (every other ParadigmsX has it; the application
                interfaces reach it as Paradigms.mkAdv)

ImpP3 has no third-person imperative to use, so it takes the standard
"niech" periphrasis. The copula takes the future ("niech x będzie grupą")
and every other verb the present ("niech x należy do A"): być is the only
Polish verb with a synthetic future, and imienne marks exactly the copular
VPs.

NomPrep: ComplCase had no nominative at all, so "jako", "niż" and
"zdefiniowany jako" -- all of which govern the nominative -- came out
locative ("mniejszy niż liczbie"). mkCompl now maps Nom to a new NomPrep,
and the dep tables of the pronouns, nounPN, mkPN and the structural NPs
cover it. LexiconNounPol is marked DO NOT EDIT, but paris_PN and john_PN
inline their own dep tables and so had to be extended too.

Two corrections:

  VerbPol.CompCN used the nominative for a predicative noun, giving
  "x jest grupa"; Polish uses the instrumental, as CompNP right below it
  already does.

  ExtendPol.ExistsNP inherited ExistNP from ExtendFunctor, giving
  "jest macierz". Polish distinguishes the two: "there exists" is istnieć,
  which is what mathematical prose uses.

ParadigmsPol.guess_paradigm_basic never matched -ość, the productive
feminine abstract suffix, so sprzeczność took a masculine declension
(*sprzeczności/a, *sprzecznościowi) despite being tagged feminine. It now
routes to the kość paradigm.

Also documents, without changing, why the 2-string mkN throws its genitive
away: guess_paradigm's 2-string table is unsound (its first branch matches
every noun in -a, and its branches disagree about whether mkNTable* takes
the nominative or the bare stem), so passing sggen to it turns
"liczba"/"liczby" into *liczbaa. The 1-string guesser is the sound path
until that table is repaired.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
aarneranta
2026-07-16 19:22:24 +02:00
parent 11f73acc28
commit 8c4cd58bd1
13 changed files with 108 additions and 12 deletions
+3
View File
@@ -16,6 +16,9 @@ flags coding=utf8 ;
AdjOrd o = {s=o.s; adv="["++o.s!AF MascPersSg Nom ++ [": the adverb form does not exist (fun AdjOrd)]"] ; isPost = False};
AdAP ada ap = { s = \\af => ada.s ++ ap.s ! af; adv = ada.s ++ ap.adv ; isPost = ap.isPost};
-- AdvAP : AP -> Adv -> AP ; -- warm by nature
AdvAP ap adv = { s = \\af => ap.s ! af ++ adv.s; adv = ap.adv ++ adv.s ; isPost = True};
-- CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John
CAdvAP c a n = {
+13 -2
View File
@@ -2,11 +2,22 @@
concrete ExtendPol of Extend =
CatPol ** ExtendFunctor - [
iFem_Pron, youFem_Pron, theyFem_Pron, ProDrop, PassVPSlash
iFem_Pron, youFem_Pron, theyFem_Pron, ProDrop, PassVPSlash, ExistsNP
]
with
(Grammar = GrammarPol) **
open PronounMorphoPol, Prelude in {
open PronounMorphoPol, ResPol, VerbMorphoPol, Prelude in {
-- ExtendFunctor defaults ExistsNP to ExistNP, which gives "jest macierz".
-- Polish distinguishes the two: "there is" is jest/są, but "there exists" is
-- istnieć, which is the form mathematical prose uses.
oper
istniec_V : Verb = mkMonoVerb "istnieć" conj52 Imperfective ;
lin ExistsNP np = {
s = \\pol,anter,tense =>
(indicative_form istniec_V False pol) ! <tense, anter, np.gn, np.p> ++ np.nom
} ;
lin iFem_Pron = pronJa FemSg ;
lin youFem_Pron = pronTy FemSg ;
+14
View File
@@ -16,6 +16,20 @@ concrete IdiomPol of Idiom = CatPol ** open Prelude, ResPol, VerbMorphoPol in {
vp.sufix !pol !NeutSg
};
-- ImpP3 : NP -> VP -> Utt ; -- let John walk
-- Polish has no third-person imperative; "niech" + a finite form is the
-- standard equivalent. The copula takes the future ("niech x będzie grupą"),
-- every other verb the present ("niech x należy do A") -- być is the only
-- Polish verb with a synthetic future, and imienne marks exactly the
-- copular VPs.
ImpP3 np vp = let
tense : Tense = case vp.imienne of { True => Fut ; False => Pres }
in {
s = "niech" ++ np.nom ++ vp.prefix ++
((indicative_form vp.verb vp.imienne Pos) !<tense, Simul, np.gn, np.p>) ++
vp.sufix !Pos !np.gn
};
-- ImpPl1 : VP -> Utt ; -- let's go
ImpPl1 vp = {
s = vp.prefix ++
+2 -2
View File
@@ -205,7 +205,7 @@
lin paris_PN =
{ nom = (mkNTable0045 "Paryż")!SF Sg Nom; voc = (mkNTable0045 "Paryż")!SF Sg VocP;
dep = let forms = (mkNTable0045 "Paryż") in table {
GenPrep|GenNoPrep=>forms!SF Sg Gen; AccPrep|AccNoPrep=>forms!SF Sg Acc;
NomPrep=>forms!SF Sg Nom; GenPrep|GenNoPrep=>forms!SF Sg Gen; AccPrep|AccNoPrep=>forms!SF Sg Acc;
DatPrep|DatNoPrep=>forms!SF Sg Dat; InstrC=>forms!SF Sg Instr;
LocPrep=>forms!SF Sg Loc};
gn= MascInaniSg ; p=P3
@@ -213,7 +213,7 @@
lin john_PN =
{ nom = (mkNTable0002 "Jan")!SF Sg Nom; voc = (mkNTable0002 "Jan")!SF Sg VocP;
dep = let forms = (mkNTable0002 "Jan") in table {
GenPrep|GenNoPrep=>forms!SF Sg Gen; AccPrep|AccNoPrep=>forms!SF Sg Acc;
NomPrep=>forms!SF Sg Nom; GenPrep|GenNoPrep=>forms!SF Sg Gen; AccPrep|AccNoPrep=>forms!SF Sg Acc;
DatPrep|DatNoPrep=>forms!SF Sg Dat; InstrC=>forms!SF Sg Instr;
LocPrep=>forms!SF Sg Loc};
gn= MascPersSg ; p=P3
+23
View File
@@ -0,0 +1,23 @@
--# -path=.:../abstract:../common
concrete MarkupPol of Markup = CatPol, MarkHTMLX ** open ResPol in {
lin
MarkupCN m cn = cn ** {s = \\n,c => appMark m (cn.s ! n ! c)} ;
-- NP has three alternative surface forms: nom, voc and the dependent
-- cases; each is marked up separately.
MarkupNP m np = np ** {
nom = appMark m np.nom ;
voc = appMark m np.voc ;
dep = \\c => appMark m (np.dep ! c)
} ;
MarkupAP m ap = ap ** {s = \\af => appMark m (ap.s ! af)} ;
MarkupAdv m adv = {s = appMark m adv.s} ;
MarkupS m s = {s = appMark m s.s} ;
MarkupUtt m utt = {s = appMark m utt.s} ;
MarkupPhr m phr = {s = appMark m phr.s} ;
MarkupText m txt = {s = appMark m txt.s} ;
}
+8
View File
@@ -60,6 +60,7 @@ oper
nom = "wszyscy" ;
voc = "wszyscy" ;
dep = table {
NomPrep => "wszyscy";
(GenNoPrep|GenPrep) => "wszystkich";
(DatNoPrep|DatPrep) => "wszystkim";
(AccNoPrep|AccPrep) => "wszystkich";
@@ -74,6 +75,7 @@ oper
nom = "wszystko" ;
voc = "wszystko" ;
dep = table {
NomPrep => "wszystko";
(GenNoPrep|GenPrep) => "wszystkiego";
(DatNoPrep|DatPrep) => "wszystkiemu";
(AccNoPrep|AccPrep) => "wszystko";
@@ -88,6 +90,7 @@ oper
nom = "ktoś" ;
voc = "ktosiu" ;
dep = table {
NomPrep => "ktoś";
(GenNoPrep|GenPrep) => "kogoś";
(DatNoPrep|DatPrep) => "komuś";
(AccNoPrep|AccPrep) => "kogoś";
@@ -102,6 +105,7 @@ oper
nom = "coś" ;
voc = "coś" ;
dep = table {
NomPrep => "coś";
(GenNoPrep|GenPrep) => "czegoś";
(DatNoPrep|DatPrep) => "czemuś";
(AccNoPrep|AccPrep) => "coś";
@@ -117,6 +121,7 @@ oper
nom = "kto" ;
voc = "kto" ;
dep = table {
NomPrep => "kto";
(GenNoPrep|GenPrep) => "kogo";
(DatNoPrep|DatPrep) => "komu";
(AccNoPrep|AccPrep) => "kogo";
@@ -131,6 +136,7 @@ oper
nom = "co" ;
voc = "co" ;
dep = table {
NomPrep => "co";
(GenNoPrep|GenPrep) => "czego";
(DatNoPrep|DatPrep) => "czemu";
(AccNoPrep|AccPrep) => "co";
@@ -216,6 +222,7 @@ oper
oper niktNP : NounPhrase =
{ voc,nom="nikt";
dep = table {
NomPrep => "nikt";
(GenNoPrep|GenPrep) => "nikogo";
(DatNoPrep|DatPrep) => "nikomu";
(AccNoPrep|AccPrep) => "nikogo";
@@ -230,6 +237,7 @@ oper
oper nicNP : NounPhrase =
{ voc,nom="nic";
dep = table {
NomPrep => "nic";
(GenNoPrep|GenPrep) => "niczego";
(DatNoPrep|DatPrep) => "niczemu";
(AccNoPrep|AccPrep) => "nic";
+1
View File
@@ -27,6 +27,7 @@ resource NounMorphoPol = open CatPol, ResPol, Prelude, (Predef=Predef) in {
{ nom = forms!SF Sg Nom;
voc = forms!SF Sg VocP;
dep = table {
NomPrep =>forms!SF Sg Nom;
GenPrep|GenNoPrep=>forms!SF Sg Gen;
AccPrep|AccNoPrep=>forms!SF Sg Acc;
DatPrep|DatNoPrep=>forms!SF Sg Dat;
+15
View File
@@ -26,10 +26,14 @@
mkA2 : A -> Str -> ComplCase -> A2 ;
mkAdv : Str -> Adv ; -- an adverb from a string
--.
-- Definitions hidden from the public API
mkAdv s = lin Adv {s = s} ;
ComplCase = ResPol.ComplCase ;
genPrep = GenPrep ;
genNoPrep = GenNoPrep ;
@@ -41,6 +45,7 @@
{ nom = (tab form)!SF Sg Nom;
voc = (tab form)!SF Sg VocP;
dep = let forms = (tab form) in table {
NomPrep =>forms!SF Sg Nom;
GenPrep|GenNoPrep=>forms!SF Sg Gen;
AccPrep|AccNoPrep=>forms!SF Sg Acc;
DatPrep|DatNoPrep=>forms!SF Sg Dat;
@@ -101,6 +106,13 @@
let ntable : SubstForm => Str = guess_paradigm_basic sgnom
in NM.mkN ntable gender ;
-- 2 string
-- NB: sggen is deliberately NOT passed to guess_paradigm. The 2-string
-- guess_paradigm table is unsound: its first branch <_ + "a", _ + "">
-- matches every noun in -a (the suffix "" matches anything), and its
-- branches disagree about whether mkNTable* takes the nominative
-- (mkNTable0021 does Predef.tk 1) or the bare stem (mkNTable0308 does
-- not). Routing sggen there turns "liczba"/"liczby" into "liczbaa".
-- Until that table is repaired, the 1-string guesser is the sound path.
mkNGender : Str -> Str -> Gender -> N = \sgnom,sggen,gender ->
let ntable : SubstForm => Str = guess_paradigm sgnom
in NM.mkN ntable gender ;
@@ -373,6 +385,9 @@
_ + "ń" => NM.mkNTable0142 sgnom ; -- Alternatives: mkNTable0268,mkNTable0290,mkNTable0297,mkNTable0468,mkNTable0592,mkNTable0612,mkNTable0674,mkNTable0676,mkNTable0775,mkNTable0815,mkNTable0935,mkNTable1004
_ + "ł" => NM.mkNTable0151 sgnom ; -- Alternatives: mkNTable0192,mkNTable0280,mkNTable0533,mkNTable0601
_ + "ę" => NM.mkNTable0379 sgnom ; -- Alternatives: mkNTable0604
-- -ość is the productive feminine abstract-noun suffix (sprzeczność,
-- własność, równość); it always takes the kość declension.
_ + "ość" => NM.mkNTable0475 sgnom ;
_ + "ć" => NM.mkNTable0069 sgnom ; -- Alternatives: mkNTable0475,mkNTable0567,mkNTable0573,mkNTable0649,mkNTable0734,mkNTable0792,mkNTable0793,mkNTable0794,mkNTable0814,mkNTable0838,mkNTable0922,mkNTable0923,mkNTable1014
_ + "ź" => NM.mkNTable0316 sgnom ; -- Alternatives: mkNTable0633,mkNTable0661,mkNTable0722,mkNTable0732,mkNTable0771
_ + "y" => NM.mkNTable0012 sgnom ; -- Alternatives: mkNTable0050,mkNTable0058,mkNTable0123,mkNTable0203,mkNTable0635,mkNTable0665,mkNTable0777,mkNTable0886,mkNTable1020
+13
View File
@@ -23,6 +23,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "ja";
voc = "ja";
dep = table {
NomPrep => "ja";
(GenNoPrep|GenPrep) => "mnie";
DatNoPrep => "mi";
DatPrep => "mnie";
@@ -114,6 +115,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
nom = "ty" ;
voc = "ty" ;
dep = table { -- it is simplyfied to avoid variants
NomPrep => "ty";
GenNoPrep => "cię";
GenPrep => "ciebie";
DatNoPrep => "tobie";
@@ -133,6 +135,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "pan" ;
voc = "panie" ;
dep = table {
NomPrep => "pan";
GenNoPrep => "pana"; --"go"};
GenPrep => "pana";
DatNoPrep => "panu"; --"mu"};
@@ -152,6 +155,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "pani" ;
voc = "pani" ;
dep = table {
NomPrep => "pani";
GenNoPrep => "pani"; --"go"};
GenPrep => "pani";
DatNoPrep => "pani"; --"mu"};
@@ -171,6 +175,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "on" ;
voc = "on" ;
dep = table {
NomPrep => "on";
GenNoPrep => "jego"; --"go"};
GenPrep => "niego";
DatNoPrep => "jemu"; --"mu"};
@@ -191,6 +196,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "ona" ;
voc = "ona" ;
dep = table {
NomPrep => "ona";
GenNoPrep => "jej";
GenPrep => "niej";
DatNoPrep => "jej";
@@ -247,6 +253,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
nom = "ono" ; -- The true nom. and voc. forms will be that of the subject
voc = "ono" ; -- Here, we use the neuter pronoun as a shortcut
dep = table {
NomPrep => "ono";
GenNoPrep => "się";
GenPrep => "siebie";
DatNoPrep => "sobie";
@@ -265,6 +272,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "ono" ;
voc = "ono" ;
dep= table {
NomPrep => "ono";
GenNoPrep => "jego"; --"go";
GenPrep => "niego";
DatNoPrep => "jemu"; --"mu";
@@ -285,6 +293,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "my";
voc = "my";
dep = table {
NomPrep => "my";
(GenNoPrep|GenPrep) => "nas";
(DatNoPrep|DatPrep) => "nam";
(AccNoPrep|AccPrep) => "nas";
@@ -338,6 +347,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "wy" ;
voc = "wy" ;
dep = table {
NomPrep => "wy";
(GenNoPrep|GenPrep) => "was";
(DatNoPrep|DatPrep) => "wam";
(AccNoPrep|AccPrep) => "was";
@@ -391,6 +401,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "oni" ;
voc = "oni" ;
dep = table {
NomPrep => "oni";
GenNoPrep => "ich";
GenPrep => "nich";
DatNoPrep => "im";
@@ -411,6 +422,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "one" ;
voc = "one" ;
dep = table {
NomPrep => "one";
GenNoPrep => "ich";
GenPrep => "nich";
DatNoPrep => "im";
@@ -429,6 +441,7 @@ resource PronounMorphoPol = ResPol ** open Prelude, (Predef=Predef) in {
{ nom = "one" ;
voc = "one" ;
dep = table {
NomPrep => "one";
GenNoPrep => "ich";
GenPrep => "nich";
DatNoPrep => "im";
+7 -7
View File
@@ -189,23 +189,23 @@
--6 Complement definition
param ComplCase = GenPrep | GenNoPrep | DatPrep | DatNoPrep |
AccPrep | AccNoPrep | InstrC | LocPrep ;
AccPrep | AccNoPrep | InstrC | LocPrep | NomPrep ;
oper
Complement : Type = {s : Str; c : ComplCase} ;
mkCompl : Str -> Case -> Complement;
mkCompl s c = {
s=s;
c = case s of {
"" => case c of { Gen => GenNoPrep; Dat => DatNoPrep; Instr => InstrC; _ => AccNoPrep };
_ => case c of { Gen => GenPrep; Dat => DatPrep; Acc => AccPrep; Instr => InstrC; _ => LocPrep }
mkCompl s c = {
s=s;
c = case s of {
"" => case c of { Gen => GenNoPrep; Dat => DatNoPrep; Instr => InstrC; Nom => NomPrep; _ => AccNoPrep };
_ => case c of { Gen => GenPrep; Dat => DatPrep; Acc => AccPrep; Instr => InstrC; Nom => NomPrep; _ => LocPrep }
}
};
extract_case = table {GenPrep => Gen; GenNoPrep => Gen; DatPrep => Dat;
DatNoPrep => Dat; AccPrep => Acc; AccNoPrep => Acc; InstrC => Instr;
LocPrep => Loc};
LocPrep => Loc; NomPrep => Nom};
--7 Various types
-- possible problem: dzieci ,ktorych piecioro bawilo sie... / okna, ktorych piec stalo opartych o sciane...
+3
View File
@@ -75,6 +75,9 @@ lin
-- AdvS : Adv -> S -> S ; -- today, I will go home
AdvS adv s = { s = adv.s ++ s.s };
ExtAdvS adv s = { s = adv.s ++ "," ++ s.s };
-- SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes
SSubjS a subj b = { s = a.s ++ "," ++ subj.s ++ b.s };
-- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
SlashPrep c p = { s=c.s; c=p };
+3
View File
@@ -87,6 +87,9 @@ lin
something_NP = cos ;
somewhere_Adv = ss "gdzieś";
that_Quant = demPronTen "tamten";
-- Polish always sets off a "że" clause with a comma, so the subordinator
-- carries it, as IdiomPol/SentencePol already do for EmbedS and SlashVS
that_Subj = ss [", że"];
there_Adv = ss "tam";
there7to_Adv = ss "tam";
there7from_Adv = ss "stamtąd";
+3 -1
View File
@@ -40,7 +40,9 @@ lin
-- CompAP : AP -> Comp ; -- (be) small
CompAP ap = { s = \\gn => ap.s ! AF gn Nom };
CompCN cn = { s = \\gn => cn.s ! numGenNum gn ! Nom }; --- AR 7/12/2010
-- a predicative noun goes in the instrumental in Polish, exactly as in
-- CompNP below: "x jest grupą", not *"x jest grupa"
CompCN cn = { s = \\gn => cn.s ! numGenNum gn ! Instr }; --- AR 7/12/2010
-- CompNP : NP -> Comp ; -- (be) a man
CompNP np = { s = \\gn => np.dep !InstrC };