sketch of the grammar generated with Codex

This commit is contained in:
Krasimir Angelov
2026-05-05 11:05:50 +02:00
parent 0cd851aa10
commit 1910010e70
10 changed files with 161 additions and 12 deletions

View File

@@ -1,4 +1,7 @@
concrete AdjectiveFao of Adjective = CatFao ** {
concrete AdjectiveFao of Adjective = CatFao ** open ResFao in {
lin
PositA a = a ;
ComparA a np = {
s = \\g,n,c => "meir" ++ a.s ! g ! n ! c ++ "enn" ++ np.s ! Nom
} ;
}

View File

@@ -9,10 +9,20 @@ lincat V = Verb ;
lincat VV,VS,VQ,VA = Verb ;
lincat V2 = Verb ** {c2 : Compl} ;
lincat V3,V2A,V2S,V2Q,V2V = Verb ** {c2,c3 : Compl} ;
lincat VP = VerbPhrase ;
lincat VPSlash = Verb ** {c2 : Compl} ;
lincat Comp = {s : Gender => Number => Str} ;
lincat Cl = Clause ;
lincat Prep = Compl ;
lincat Pron = {s : Case => Str; g : Gender; n : Number; p : Person} ;
lincat CN = CommonNoun ;
lincat NP, Pron = {s : Case => Str ; g : Gender ; n : Number ; p : Person} ;
lincat RCl = {s : Tense => Polarity => Gender => PersNum => Str} ;
lincat RS = {s : Gender => PersNum => Str} ;
lincat RP = {s : Str} ;
lincat AP = AdjPhrase ;
lincat Det = {s : Gender => Case => Str ; n : Number ; sp : Species} ;
lincat Quant = {s : Gender => Number => Case => Str ; sp : Species} ;
lincat Num = {s : Gender => Case => Str ; n : Number} ;
lincat S = {s : Str} ;
lincat LN,SN,GN,PN = {s : Str} ;

View File

@@ -2,6 +2,9 @@ concrete GrammarFao of Grammar =
TenseX,
PhraseFao,
NounFao,
VerbFao,
AdjectiveFao,
SentenceFao,
RelativeFao,
StructuralFao ** {
}

View File

@@ -1,2 +1,9 @@
concrete LexiconFao of Lexicon = CatFao ** open ParadigmsFao in {
concrete LexiconFao of Lexicon = CatFao ** open ParadigmsFao, ResFao in {
lin
apple_N = mkN "epli" ;
big_A = mkA "stórur" ;
child_N = mkN "barn" ;
die_V = mkV "doyggja" "doyrt" ;
good_A = mkA "góður" ;
go_V = mkVerb "farið" "far" "farið" "fari" "fert" "fer" "fara" "fór" "fórt" "fór" "fóru" "fara" "farandi" "farin" ;
}

View File

@@ -1,4 +1,51 @@
concrete NounFao of Noun = CatFao ** {
concrete NounFao of Noun = CatFao ** open ResFao in {
lin
UseN n = n ;
UsePron p = p ;
RelNP np rs =
np ** {s = \\c => np.s ! c ++ "," ++ rs.s ! np.g ! persNum np.n np.p} ;
DetCN det cn = {
s = \\c => det.s ! cn.g ! c ++ cn.s ! det.sp ! det.n ! c ;
g = cn.g ;
n = det.n ;
p = P3
} ;
DefArt = {
s = \\_,_,_ => [] ;
sp = Def
} ;
IndefArt = {
s = table {
Masc => table {
Sg => table {Nom => "ein" ; Acc => "ein" ; Dat => "einum" ; Gen => "eins"} ;
Pl => \\_ => []
} ;
Fem => table {
Sg => table {Nom => "ein" ; Acc => "eina" ; Dat => "einari" ; Gen => "einar"} ;
Pl => \\_ => []
} ;
Neuter => table {
Sg => table {Nom => "eitt" ; Acc => "eitt" ; Dat => "einum" ; Gen => "eins"} ;
Pl => \\_ => []
}
} ;
sp = Indef
} ;
DetQuant quant num = {
s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ;
n = num.n ;
sp = quant.sp
} ;
NumSg = {
s = \\_,_ => [] ;
n = Sg
} ;
NumPl = {
s = \\_,_ => [] ;
n = Pl
} ;
AdjCN ap cn = {
s = \\sp,n,c => ap.s ! cn.g ! n ! c ++ cn.s ! sp ! n ! c ;
g = cn.g
} ;
}

View File

@@ -569,9 +569,9 @@ oper
mkIQuant : Str -> IQuant = \s -> lin IQuant {s=s} ;
mkIDet : Str -> IDet = \s -> lin IDet {s=s} ;
mkSubj : Str -> Subj = \s -> lin Subj {s=s} ;
mkQuant : Str -> Quant = \s -> lin Quant {s=s} ;
mkQuant : Str -> Quant = \s -> lin Quant {s=\\_,_,_ => s; sp=Indef} ;
mkPredet : Str -> Predet = \s -> lin Predet {s=s} ;
mkDet : Str -> Det = \s -> lin Det {s=s} ;
mkDet : Str -> Det = \s -> lin Det {s=\\_,_ => s; n=Sg; sp=Indef} ;
mkCard : Str -> Card = \s -> lin Card {s=s} ;
mkACard : Str -> ACard = \s -> lin ACard {s=s} ;
mkConj : Str -> Conj = \s -> lin Conj {s=s} ;

View File

@@ -1,8 +1,10 @@
concrete PhraseFao of Phrase = CatFao ** {
concrete PhraseFao of Phrase = CatFao ** open ResFao in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ;
UttNP np = {s = np.s ! Nom} ;
UttVP vp = {s = vp.Nonfinite} ;
UttInterj i = i ;
NoPConj = {s = []} ;

View File

@@ -0,0 +1,7 @@
concrete RelativeFao of Relative = CatFao ** open ResFao in {
lin
IdRP = {s = "sum"} ;
RelVP rp vp = {
s = \\t,pol,g,pn => rp.s ++ vp.Indicative ! t ! pol ! g ! pn
} ;
}

View File

@@ -1,7 +1,6 @@
resource ResFao = {
resource ResFao = ParamX - [Tense,Pres,Past] ** {
param Species = Indef | Def ;
param Number = Sg | Pl ;
param Case = Nom | Acc | Dat | Gen ;
param Gender = Masc | Fem | Neuter ;
oper Noun = {s: Species => Number => Case => Str; g : Gender} ; -- 2135
@@ -90,9 +89,20 @@ oper mkAdj : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Adj =
}
} ;
param Tense = Past | Pres ;
param Tense = Pres | Past ;
param PersNum = PSg Person | PPl ;
param Person = P1 | P3 | P2 ;
oper persNum : Number -> Person -> PersNum =
\n,p -> case n of {
Sg => PSg p ;
Pl => PPl
} ;
oper persNumNumber : PersNum -> Number =
\pn -> case pn of {
PSg _ => Sg ;
PPl => Pl
} ;
oper Verb = {Converb: Str; imperative: Number => Str; Indicative: Tense => PersNum => Str; Nonfinite: Str; Participle: Tense => Str ; particle : Str} ; -- 596
oper mkVerb : (_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Verb =
\f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14 ->
@@ -129,5 +139,34 @@ oper noPrep : Compl = {s=""; c=Acc} ;
oper CommonNoun = Noun ;
oper AdjPhrase = Adj ;
oper VerbPhrase = {
Converb : Str ;
Indicative : Tense => Polarity => Gender => PersNum => Str ;
Nonfinite : Str ;
Participle : Tense => Str ;
} ;
oper Clause = {
Converb : Str ;
Indicative : Tense => Polarity => Str ;
Nonfinite : Str ;
Participle : Tense => Str
} ;
oper
copula : Tense => PersNum => Str =
table {
Pres => table {
PSg P1 => "eri" ;
PSg P2 => "ert" ;
PSg P3 => "er" ;
PPl => "eru"
} ;
Past => table {
PSg P1 => "var" ;
PSg P2 => "vart" ;
PSg P3 => "var" ;
PPl => "vóru"
}
} ;
}

View File

@@ -0,0 +1,31 @@
concrete SentenceFao of Sentence = CatFao ** open Prelude, ResFao, (P = ParamX) in {
lin PredVP np vp = {Converb = np.s ! Nom ++ vp.Converb;
Indicative = \\t,pol =>
let p = persNum np.n np.p
in np.s ! Nom ++ vp.Indicative ! t ! pol ! np.g ! p;
Nonfinite = np.s ! Nom ++ vp.Nonfinite;
Participle = \\t => np.s ! Nom ++ vp.Participle ! t} ;
UseCl temp pol cl =
let
tense = case temp.t of {
P.Pres => Pres ;
P.Past => Past ;
P.Fut => Pres ;
P.Cond => Past
} ;
in {
s = temp.s ++ pol.s ++ cl.Indicative ! tense ! pol.p
} ;
UseRCl temp pol rcl =
let
tense = case temp.t of {
P.Pres => Pres ;
P.Past => Past ;
P.Fut => Pres ;
P.Cond => Past
}
in {
s = \\g,pn =>
temp.s ++ pol.s ++ rcl.s ! tense ! pol.p ! g ! pn
} ;
}