1
0
forked from GitHub/gf-rgl

(Hun) Add possibility to prepose Advs

This commit is contained in:
Inari Listenmaa
2020-04-24 17:00:44 +02:00
parent 346360d54a
commit f24d9c2cad
8 changed files with 38 additions and 17 deletions

View File

@@ -12,7 +12,8 @@ lin
-- : Prep -> NP -> Adv ;
PrepNP prep np = {
s = applyAdp prep np
s = applyAdp prep np ;
isPre = False ;
} ;
-- Adverbs can be modified by 'adadjectives', just like adjectives.

View File

@@ -1,4 +1,4 @@
concrete CatHun of Cat = CommonX ** open ResHun, Prelude in {
concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
flags optimize=all_subs ;
@@ -118,6 +118,8 @@ concrete CatHun of Cat = CommonX ** open ResHun, Prelude in {
N3 = ResHun.Noun ;
PN = ResHun.NounPhrase ;
Adv = {s : Str ; isPre : Bool} ;
linref
CN = linCN ;

View File

@@ -3,12 +3,20 @@ concrete ConjunctionHun of Conjunction =
-- Adverb and other simple {s : Str} types.
lincat
[Adv],[AdV],[IAdv],[S] = {s1,s2 : Str} ;
[AdV],[IAdv],[S] = {s1,s2 : Str} ;
lin
BaseAdv, BaseAdV, BaseIAdv, BaseS = twoSS ;
ConsAdv, ConsAdV, ConsIAdv, ConsS = consrSS comma ;
ConjAdv, ConjAdV, ConjIAdv, ConjS = conjunctDistrSS ;
BaseAdV, BaseIAdv, BaseS = twoSS ;
ConsAdV, ConsIAdv, ConsS = consrSS comma ;
ConjAdV, ConjIAdv, ConjS = conjunctDistrSS ;
lincat
[Adv] = {s1,s2 : Str ; isPre : Bool} ;
lin
BaseAdv x y = y ** twoSS x y ;
ConsAdv x xs = xs ** consrSS comma x xs ;
ConjAdv co xs = xs ** conjunctDistrSS co xs ;
-- Adjectival phrases
lincat

View File

@@ -9,10 +9,10 @@ concrete GrammarHun of Grammar =
RelativeHun,
ConjunctionHun,
PhraseHun,
TextX,
TextX - [Adv],
StructuralHun,
IdiomHun,
TenseX
TenseX - [Adv]
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -1,4 +1,5 @@
concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
concrete NounHun of Noun = CatHun ** open
ResHun, Prelude, Coordination in {
flags optimize=all_subs ;
@@ -40,7 +41,13 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
-- : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s ;
s = \\c => case adv.isPre of {
True => adv.s ++ np.s ! c ;
False => np.s ! c ++ adv.s } ;
-- compl = \\nc => case adv.isPre of {
-- True => np.compl ! nc ;
-- False => np.compl ! nc ++ adv.s } ;
} ;
-- : NP -> Adv -> NP ; -- boys, such as ..
ExtAdvNP np adv = np ** {
@@ -202,9 +209,10 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude, Coordination in {
} ;
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** {
compl = \\n,c => cn.compl ! n ! c ++ adv.s
} ;
AdvCN cn adv = case adv.isPre of {
True => AdjCN (invarAP adv.s) cn ;
False => cn ** {compl = \\n,c => cn.compl ! n ! c ++ adv.s}
} ;
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications

View File

@@ -101,7 +101,7 @@ oper
-- lin Subj { } ;
mkAdv : Str -> Adv
= \s -> lin Adv {s = s} ;
= \s -> lin Adv {s = s ; isPre=False} ;
mkAdV : Str -> AdV
= \s -> lin AdV {s = s} ;

View File

@@ -336,6 +336,8 @@ oper
in adj + plural
} ;
invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_ => s} ;
-- https://en.wikisource.org/wiki/Simplified_Grammar_of_the_Hungarian_Language/Adjectives
comparAdj : Str -> Str = \stem ->
case stem of {

View File

@@ -24,16 +24,16 @@ oper
lin
-- : CN -> Int -> NP
CNIntNP cn i = NH.MassNP (cn ** {
s = \\n,c => cn.s ! n ! c ++ i.s}) ;
compl = \\n,c => cn.compl ! n ! c ++ i.s}) ;
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
CNSymbNP det cn xs =
let cnSymb : CN = cn ** {s = \\n,c => cn.s ! n ! c ++ xs.s}
let cnSymb : CN = cn ** {compl = \\n,c => cn.compl ! n ! c ++ xs.s}
in NH.DetCN det cnSymb ;
-- : CN -> Card -> NP ; -- level five ; level 5
CNNumNP cn i = NH.MassNP (cn ** {
s = \\n,c => cn.s ! n ! c ++ i.s ! Indep}) ;
compl = \\n,c => cn.compl ! n ! c ++ i.s ! Indep}) ;
-- : Symb -> S ;
SymbS sy = sy ;