forked from GitHub/gf-rgl
(Ara) Better checks if a Num or Ord is a numeral
This commit is contained in:
@@ -49,8 +49,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
|
||||
|
||||
CN = ResAra.Noun ** {adj : NTable};
|
||||
NP, Pron = ResAra.NP; --{s : Case => Str ; a : Agr } ;
|
||||
Ord,
|
||||
Num,
|
||||
Ord,
|
||||
Card = ResAra.NumOrdCard ;
|
||||
Predet = ResAra.Predet ;
|
||||
|
||||
|
||||
@@ -249,8 +249,8 @@ flags
|
||||
jump_V = regV "يَقفِز" ;
|
||||
-- jump_V = v1 "قفز" a i ;
|
||||
|
||||
left_Ord = mkOrd "أَيسَر" "يُسرَى";
|
||||
right_Ord = mkOrd "أَيمَن" "يُمنَى" ;
|
||||
left_Ord = mkOrd "أَيسَر" "يُسرَى" One;
|
||||
right_Ord = mkOrd "أَيمَن" "يُمنَى" One;
|
||||
|
||||
far_Adv = mkAdv "بَعِيداً" ;
|
||||
correct_A = sndA "صحّ" "فَعِيل" ;
|
||||
|
||||
@@ -78,10 +78,9 @@ lin
|
||||
n = num.n;
|
||||
d = quant.d;
|
||||
isPron = quant.isPron;
|
||||
isNum =
|
||||
case num.n of {
|
||||
None => False;
|
||||
_ => True
|
||||
isNum = case num.n of {
|
||||
None => ord.isNum ; -- ord may come from OrdDigits or OrdNumeral
|
||||
_ => True
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -91,20 +90,13 @@ lin
|
||||
n = num.n;
|
||||
d = quant.d;
|
||||
isPron = quant.isPron;
|
||||
isNum =
|
||||
isNum = -- Num may come from NumCard : Card -> Num
|
||||
case num.n of {
|
||||
None => False;
|
||||
_ => True
|
||||
_ => True
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
--DEPRECATED
|
||||
-- SgQuant quant = {s = quant.s ! Sg ; d = quant.d;
|
||||
-- isPron = quant.isPron; isNum = False} ;
|
||||
-- PlQuant quant = {s = quant.s ! Pl ; d = quant.d;
|
||||
-- isPron = quant.isPron; isNum = False} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\_,_,_,_ => p.s ! Gen;
|
||||
d = Const;
|
||||
@@ -113,37 +105,39 @@ lin
|
||||
|
||||
NumSg = {
|
||||
s = \\_,_,_ => [] ;
|
||||
n = One } ;
|
||||
n = One ;
|
||||
isNum = False } ;
|
||||
|
||||
NumPl = {
|
||||
s = \\_,_,_ => [] ;
|
||||
n = None } ;
|
||||
n = None ;
|
||||
isNum = False } ;
|
||||
|
||||
NumDigits digits = {
|
||||
s = \\_,_,_ => digits.s;
|
||||
n = digits.n
|
||||
NumDigits digits = digits ** {
|
||||
s = \\_,_,_ => digits.s ;
|
||||
isNum = True
|
||||
};
|
||||
|
||||
NumNumeral numeral = {
|
||||
NumNumeral numeral = numeral ** {
|
||||
s = numeral.s ! NCard ;
|
||||
n = numeral.n
|
||||
isNum = True
|
||||
};
|
||||
|
||||
NumCard n = n ;
|
||||
|
||||
AdNum adn num = {
|
||||
AdNum adn num = num ** {
|
||||
s = \\g,d,c => adn.s ++ num.s ! g ! d ! c ;
|
||||
n = num.n } ;
|
||||
} ;
|
||||
|
||||
OrdDigits digits = {
|
||||
OrdDigits digits = digits ** {
|
||||
s = \\_,d,_ => Al ! d ++ digits.s;
|
||||
n = digits.n
|
||||
isNum = True
|
||||
};
|
||||
|
||||
-- OrdNumeral : Numeral -> Ord ; -- fifty-first
|
||||
OrdNumeral numeral = {
|
||||
OrdNumeral numeral = numeral ** {
|
||||
s = numeral.s ! NOrd ;
|
||||
n = numeral.n
|
||||
isNum = True
|
||||
};
|
||||
|
||||
-- FIXME, "the biggest house" would better translate into
|
||||
@@ -151,7 +145,8 @@ lin
|
||||
-- DetCN (DetSg DefArt (OrdSuperl big_A)) (UseN house_N)
|
||||
OrdSuperl a = {
|
||||
s = \\_,d,c => a.s ! AComp d c;
|
||||
n = One
|
||||
n = One ;
|
||||
isNum = False
|
||||
} ;
|
||||
|
||||
DefArt = {
|
||||
|
||||
@@ -478,7 +478,7 @@ resource ParadigmsAra = open
|
||||
<Hum,_,_,_> => ula'ika;
|
||||
_ => tilka
|
||||
};
|
||||
d = Def;
|
||||
d = det;
|
||||
isPron = False;
|
||||
isNum = False;
|
||||
lock_Quant = <>
|
||||
|
||||
@@ -117,8 +117,10 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
NumOrdCard : Type = {
|
||||
s : Gender => State => Case => Str ;
|
||||
n : Size ;
|
||||
isNum : Bool
|
||||
} ;
|
||||
|
||||
|
||||
uttNum : NumOrdCard -> (Gender => Str) ;
|
||||
uttNum n = \\g => n.s ! g ! Def ! Nom ; ----IL
|
||||
|
||||
@@ -1085,21 +1087,26 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
case pgn of {
|
||||
Per3 gn nm => {g = gn; n = nm};
|
||||
Per2 gn nm => {g = gn; n = nm};
|
||||
_ => {g = Masc; n = Sg} --randomly
|
||||
Per1 nm => {g = Masc; --randomly
|
||||
n = case nm of {
|
||||
Sing => Sg ;
|
||||
Plur => Pl}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
mkIP : Str -> Number -> IP =
|
||||
\s,n -> {s = \\_g,_s,_c => s ; n = n} ;
|
||||
|
||||
mkOrd : (_,_ : Str) -> NumOrdCard =
|
||||
\aysar,yusra ->
|
||||
mkOrd : (_,_ : Str) -> Size -> NumOrdCard =
|
||||
\aysar,yusra,sz ->
|
||||
{ s = \\g,s,c =>
|
||||
case g of {
|
||||
Masc => (sing aysar) ! s ! c;
|
||||
Fem => (sing yusra) ! s ! c
|
||||
};
|
||||
n = None
|
||||
n = sz ;
|
||||
isNum = False
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ lin
|
||||
SymbS sy = sy ;
|
||||
|
||||
|
||||
SymbOrd n = {s = \\_,_,_ => n.s ; n = None } ;
|
||||
SymbNum n = SymbOrd n ** { n = ThreeTen } ; ----IL
|
||||
SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ;
|
||||
SymbNum n = SymbOrd n ** { n = ThreeTen ; isNum = True } ; ----IL
|
||||
|
||||
lincat
|
||||
|
||||
|
||||
Reference in New Issue
Block a user