mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-28 01:18:57 -06:00
(Hun) Prevent redundant use of IndefArt in DetQuant with a Numeral
This commit is contained in:
@@ -58,7 +58,9 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude in {
|
|||||||
|
|
||||||
-- : Quant -> Num -> Det ;
|
-- : Quant -> Num -> Det ;
|
||||||
DetQuant quant num = quant ** num ** {
|
DetQuant quant num = quant ** num ** {
|
||||||
s = \\c => quant.s ! num.n ! c
|
s = \\c => case <isNum num,quant.isIndefArt> of {
|
||||||
|
<True,True> => [] ; -- don't output "a 2 cars"
|
||||||
|
_ => quant.s ! num.n ! c }
|
||||||
++ num.s ! Attrib ; -- TODO: add inflection table in numbers
|
++ num.s ! Attrib ; -- TODO: add inflection table in numbers
|
||||||
sp = \\c => quant.sp ! num.n ! c
|
sp = \\c => quant.sp ! num.n ! c
|
||||||
++ num.s ! Indep
|
++ num.s ! Indep
|
||||||
@@ -115,13 +117,14 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude in {
|
|||||||
DefArt = {
|
DefArt = {
|
||||||
s,
|
s,
|
||||||
sp = \\_,_ => pre {"a" ; "az" / v } ;
|
sp = \\_,_ => pre {"a" ; "az" / v } ;
|
||||||
|
isIndefArt = False ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
-- : Quant
|
-- : Quant
|
||||||
IndefArt = {
|
IndefArt = {
|
||||||
s,
|
s,
|
||||||
sp = \\_,_ => "egy" ;
|
sp = \\_,_ => "egy" ;
|
||||||
|
isIndefArt = True ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Pron -> Quant
|
-- : Pron -> Quant
|
||||||
|
|||||||
@@ -30,48 +30,48 @@ lin
|
|||||||
pot0 d = d ;
|
pot0 d = d ;
|
||||||
|
|
||||||
-- : Sub100 ; -- 10
|
-- : Sub100 ; -- 10
|
||||||
pot110 = {s = table {p => "tíz"} ; n=Pl} ;
|
pot110 = {s = table {p => "tíz"} ; n = Pl ; numtype = IsNum} ;
|
||||||
-- : Sub100 ; -- 11
|
-- : Sub100 ; -- 11
|
||||||
pot111 = {s = table {p => "tizenegy"} ; n=Pl} ;
|
pot111 = {s = table {p => "tizenegy"} ; n = Pl ; numtype = IsNum} ;
|
||||||
-- : Digit -> Sub100 ; -- 10 + d
|
-- : Digit -> Sub100 ; -- 10 + d
|
||||||
pot1to19 d =
|
pot1to19 d =
|
||||||
{s = table {p => "tizen" ++ d.s ! <Unit,p>} ;
|
{s = table {p => "tizen" ++ d.s ! <Unit,p>} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
-- : Sub10 -> Sub100 ; -- coercion of 1..9
|
-- : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||||
pot0as1 n =
|
pot0as1 n =
|
||||||
{s = table {p => n.s ! <Unit,p>} ;
|
{s = table {p => n.s ! <Unit,p>} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
|
|
||||||
-- : Digit -> Sub100 ; -- d * 10
|
-- : Digit -> Sub100 ; -- d * 10
|
||||||
pot1 d =
|
pot1 d =
|
||||||
{s = table {p => d.s ! <Ten,p>} ;
|
{s = table {p => d.s ! <Ten,p>} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
-- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
-- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||||
pot1plus d e =
|
pot1plus d e =
|
||||||
{s = table {p => (d.s ! <Ten,Attrib>) ++ e.s ! <Unit,p>} ;
|
{s = table {p => (d.s ! <Ten,Attrib>) ++ e.s ! <Unit,p>} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
|
|
||||||
-- : Sub100 -> Sub1000 ; -- coercion of 1..99
|
-- : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||||
pot1as2 n = n ;
|
pot1as2 n = n ;
|
||||||
-- : Sub10 -> Sub1000 ; -- m * 100
|
-- : Sub10 -> Sub1000 ; -- m * 100
|
||||||
pot2 d =
|
pot2 d =
|
||||||
{s = table {p => (d.s ! <Unit,Attrib>) ++ "száz"} ;
|
{s = table {p => (d.s ! <Unit,Attrib>) ++ "száz"} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
-- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
-- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||||
pot2plus d e =
|
pot2plus d e =
|
||||||
{s = table {p => (d.s ! <Unit,Attrib>) ++ "száz" ++ e.s ! p} ;
|
{s = table {p => (d.s ! <Unit,Attrib>) ++ "száz" ++ e.s ! p} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
|
|
||||||
-- : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
-- : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||||
pot2as3 n = n ;
|
pot2as3 n = n ;
|
||||||
-- : Sub1000 -> Sub1000000 ; -- m * 1000
|
-- : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||||
pot3 n =
|
pot3 n =
|
||||||
{s = table {p => n.s ! Attrib ++ "ezer"} ;
|
{s = table {p => n.s ! Attrib ++ "ezer"} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||||
pot3plus n m =
|
pot3plus n m =
|
||||||
{s = table {p => n.s ! Attrib ++ "ezer" ++ m.s ! p} ;
|
{s = table {p => n.s ! Attrib ++ "ezer" ++ m.s ! p} ;
|
||||||
n = Pl} ;
|
n = Pl ; numtype = IsNum} ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
LinDigit : Type = {s : DForm*Place => Str ; n : Number} ;
|
LinDigit : Type = {s : DForm*Place => Str ; n : Number} ;
|
||||||
@@ -85,7 +85,8 @@ oper
|
|||||||
<Unit,Attrib> => ua ;
|
<Unit,Attrib> => ua ;
|
||||||
<Ten, Attrib> => ta } ;
|
<Ten, Attrib> => ta } ;
|
||||||
-- ord = ord ; -- TODO figure out where to use ordinal
|
-- ord = ord ; -- TODO figure out where to use ordinal
|
||||||
n = Pl
|
n = Pl ;
|
||||||
|
numType = IsNum ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,13 +65,13 @@ param
|
|||||||
|
|
||||||
CardOrd = NOrd | NCard ; -- Not used yet
|
CardOrd = NOrd | NCard ; -- Not used yet
|
||||||
|
|
||||||
-- NumType = NoNum | IsDig | IsNum ;
|
NumType = NoNum | IsDig | IsNum ;
|
||||||
|
|
||||||
-- oper
|
oper
|
||||||
-- isNum : {numtype : NumType} -> Bool = \nt -> case nt.numtype of {
|
isNum : {numtype : NumType} -> Bool = \nt -> case nt.numtype of {
|
||||||
-- NoNum => False ;
|
NoNum => False ;
|
||||||
-- _ => True
|
_ => True
|
||||||
-- } ;
|
} ;
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Adjectives
|
-- Adjectives
|
||||||
|
|
||||||
|
|||||||
@@ -102,11 +102,13 @@ oper
|
|||||||
Quant : Type = {
|
Quant : Type = {
|
||||||
s, -- form that comes before noun: "{this} car"
|
s, -- form that comes before noun: "{this} car"
|
||||||
sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP)
|
sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP)
|
||||||
|
isIndefArt : Bool ; -- standard trick to prevent "a one car"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
|
mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
|
||||||
s = (mkNoun s).s ;
|
s = (mkNoun s).s ;
|
||||||
sp = (mkNoun sp).s ;
|
sp = (mkNoun sp).s ;
|
||||||
|
isIndefArt = False ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Det is formed in DetQuant : Quant -> Num -> Det
|
-- Det is formed in DetQuant : Quant -> Num -> Det
|
||||||
@@ -115,19 +117,19 @@ oper
|
|||||||
s,
|
s,
|
||||||
sp : Case => Str ;
|
sp : Case => Str ;
|
||||||
n : Number ;
|
n : Number ;
|
||||||
-- numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
|
numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
Num : Type = {
|
Num : Type = {
|
||||||
s : Place => Str ; -- Independent or attribute
|
s : Place => Str ; -- Independent or attribute
|
||||||
n : Number ; -- Singular or plural
|
n : Number ; -- Singular or plural
|
||||||
-- numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages
|
numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
baseNum : Num = {
|
baseNum : Num = {
|
||||||
s = \\_ => [] ;
|
s = \\_ => [] ;
|
||||||
n = Sg ;
|
n = Sg ;
|
||||||
-- numtype = NoNum
|
numtype = NoNum
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
{- Numeral can become Num via
|
{- Numeral can become Num via
|
||||||
|
|||||||
Reference in New Issue
Block a user