Merge pull request #56 from odanoburu/time

(Construction{Eng,Por}) add timeHour and timeHourMinute
This commit is contained in:
Inari Listenmaa
2018-11-01 11:44:52 +01:00
committed by GitHub
3 changed files with 135 additions and 9 deletions

View File

@@ -71,6 +71,7 @@ fun
cat cat
Timeunit ; Timeunit ;
Hour ;
Weekday ; Weekday ;
Month ; Month ;
Monthday ; Monthday ;
@@ -79,6 +80,34 @@ cat
fun fun
timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours
oneHour : Hour ;
twoHour : Hour ;
threeHour : Hour ;
fourHour : Hour ;
fiveHour : Hour ;
sixHour : Hour ;
sevenHour : Hour ;
eightHour : Hour ;
nineHour : Hour ;
tenHour : Hour ;
elevenHour : Hour ;
twelveHour : Hour ;
thirteenHour : Hour ;
fourteenHour : Hour ;
fifteenHour : Hour ;
sixteenHour : Hour ;
seventeenHour : Hour ;
eighteenHour : Hour ;
nineteenHour : Hour ;
twentyHour : Hour ;
twentyOneHour : Hour ;
twentyTwoHour : Hour ;
twentyThreeHour : Hour ;
twentyFourHour : Hour ;
timeHour : Hour -> Adv ; -- at three (o'clock / am / pm)
timeHourMinute : Hour -> Card -> Adv ; -- at forty past six
weekdayPunctualAdv : Weekday -> Adv ; -- on Monday weekdayPunctualAdv : Weekday -> Adv ; -- on Monday
weekdayHabitualAdv : Weekday -> Adv ; -- on Mondays weekdayHabitualAdv : Weekday -> Adv ; -- on Mondays
weekdayLastAdv : Weekday -> Adv ; -- last Monday weekdayLastAdv : Weekday -> Adv ; -- last Monday

View File

@@ -1,7 +1,7 @@
--# -path=.:../abstract --# -path=.:../abstract
concrete ConstructionEng of Construction = CatEng ** concrete ConstructionEng of Construction = CatEng **
open SyntaxEng, SymbolicEng, ParadigmsEng, (L = LexiconEng), (E = ExtendEng), (G = GrammarEng), (R = ResEng), (S = StructuralEng), Prelude in { open SyntaxEng, SymbolicEng, ParadigmsEng, (L = LexiconEng), (E = ExtendEng), (G = GrammarEng), (R = ResEng), (Sy = SyntaxEng), (S = StructuralEng), Prelude in {
lin lin
@@ -62,16 +62,60 @@ oper from_where_IAdv : IAdv = lin IAdv (ss "from where") ;
lincat lincat
Timeunit = N ; Timeunit = N ;
Hour = {s : Str ; am : Bool} ;
Weekday = N ; Weekday = N ;
Monthday = NP ; Monthday = NP ;
Month = N ; Month = N ;
Year = NP ; Year = NP ;
lin
lin
timeunitAdv n time = timeunitAdv n time =
let n_card : Card = n ; let n_card : Card = n ;
n_hours_NP : NP = mkNP n_card time ; n_hours_NP : NP = mkNP n_card time ;
in SyntaxEng.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; in Sy.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
oneHour = mkHour "1" True ;
twoHour = mkHour "2" True ;
threeHour = mkHour "3" True ;
fourHour = mkHour "4" True ;
fiveHour = mkHour "5" True ;
sixHour = mkHour "6" True ;
sevenHour = mkHour "7" True ;
eightHour = mkHour "8" True ;
nineHour = mkHour "9" True ;
tenHour = mkHour "10" True ;
elevenHour = mkHour "11" True ;
twelveHour = mkHour "12" False ;
thirteenHour = mkHour "1" False ;
fourteenHour = mkHour "2" False ;
fifteenHour = mkHour "3" False ;
sixteenHour = mkHour "4" False ;
seventeenHour = mkHour "5" False ;
eighteenHour = mkHour "6" False ;
nineteenHour = mkHour "7" False ;
twentyHour = mkHour "8" False ;
twentyOneHour = mkHour "9" False ;
twentyTwoHour = mkHour "10" False ;
twentyThreeHour = mkHour "11" False ;
twentyFourHour = mkHour "12" True ;
timeHour h = Sy.mkAdv at_Prep (symb (h.s ++ ampm ! h.am)) ;
timeHourMinute h m = let
min = m.s ! True ! R.Nom
in
Sy.mkAdv at_Prep (symb (h.s ++ min ++ ampm ! h.am)) ;
oper
mkHour : Str -> Bool -> {s : Str ; am : Bool} ;
mkHour n am = Sy.mkUtt (Sy.mkCard n) ** {am = am} ;
at_Prep : Prep ;
at_Prep = mkPrep "at" ;
ampm : Bool => Str ;
ampm = table {True => "a.m." ; False => "p.m."} ;
lin
weekdayPunctualAdv w = SyntaxEng.mkAdv on_Prep (mkNP w) ; -- on Sunday weekdayPunctualAdv w = SyntaxEng.mkAdv on_Prep (mkNP w) ; -- on Sunday
weekdayHabitualAdv w = SyntaxEng.mkAdv on_Prep (mkNP aPl_Det w) ; -- on Sundays weekdayHabitualAdv w = SyntaxEng.mkAdv on_Prep (mkNP aPl_Det w) ; -- on Sundays
weekdayNextAdv w = SyntaxEng.mkAdv (mkPrep "next") (mkNP w) ; -- next Sunday weekdayNextAdv w = SyntaxEng.mkAdv (mkPrep "next") (mkNP w) ; -- next Sunday

View File

@@ -3,7 +3,7 @@
concrete ConstructionPor of Construction = CatPor ** concrete ConstructionPor of Construction = CatPor **
open SyntaxPor, SymbolicPor, ParadigmsPor, BeschPor, open SyntaxPor, SymbolicPor, ParadigmsPor, BeschPor,
(L = LexiconPor), (E = ExtraPor), (B = IrregBeschPor), (R = ResPor), (L = LexiconPor), (E = ExtraPor), (B = IrregBeschPor), (R = ResPor),
(S = SyntaxPor), (C = CommonRomance), (S = SyntaxPor), (C = CommonRomance), CommonRomance,
Prelude in { Prelude in {
flags coding=utf8 ; flags coding=utf8 ;
@@ -52,11 +52,16 @@ lin
lincat lincat
Timeunit = N ; Timeunit = N ;
Hour = {s : Str ; pe : Period ; n : Number} ;
Weekday = N ; Weekday = N ;
Monthday = NP ; Monthday = NP ;
Month = N ; Month = N ;
Year = NP ; Year = NP ;
oper
param
Period = Manha | Tarde | Noite | None ;
oper
noPrep : Prep = mkPrep [] ; noPrep : Prep = mkPrep [] ;
lin lin
@@ -65,6 +70,54 @@ oper
n_hours_NP : NP = mkNP n_card time ; n_hours_NP : NP = mkNP n_card time ;
in S.mkAdv for_Prep n_hours_NP | S.mkAdv to_Prep n_hours_NP ;--| S.mkAdv (n_hours_NP.s ! R.Nom) ; in S.mkAdv for_Prep n_hours_NP | S.mkAdv to_Prep n_hours_NP ;--| S.mkAdv (n_hours_NP.s ! R.Nom) ;
oneHour = mkHour "1" Manha Sg ;
twoHour = mkHour "2" Manha Pl ;
threeHour = mkHour "3" Manha Pl ;
fourHour = mkHour "4" Manha Pl ;
fiveHour = mkHour "5" Manha Pl ;
sixHour = mkHour "6" Manha Pl ;
sevenHour = mkHour "7" Manha Pl ;
eightHour = mkHour "8" Manha Pl ;
nineHour = mkHour "9" Manha Pl ;
tenHour = mkHour "10" Manha Pl ;
elevenHour = mkHour "11" Manha Pl ;
twelveHour = {s = "meio-dia" ; pe = None ; n = Sg} ;
thirteenHour = mkHour "13" Tarde Pl ;
fourteenHour = mkHour "14" Tarde Pl ;
fifteenHour = mkHour "15" Tarde Pl ;
sixteenHour = mkHour "16" Tarde Pl ;
seventeenHour = mkHour "17" Tarde Pl ;
eighteenHour = mkHour "18" Tarde Pl ;
nineteenHour = mkHour "19" Noite Pl ;
twentyHour = mkHour "20" Noite Pl ;
twentyOneHour = mkHour "21" Noite Pl ;
twentyTwoHour = mkHour "22" Noite Pl ;
twentyThreeHour = mkHour "23" Noite Pl ;
twentyFourHour = {s = "meia-noite" ; pe = None ; n = Sg} ;
timeHour h = mkAdv (a ! h.n ++ h.s ++ period ! h.pe) ;
timeHourMinute h m = let
min = m.s ! Masc
in
mkAdv (a ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ;
oper
mkHour : Str -> Period -> Number -> {s : Str ; pe : Period ; n : Number} ;
mkHour num pe n = S.mkUtt (S.mkCard num) ** {pe = pe ; n = n} ;
period : Period => Str ;
period = table {
Manha => "da manhã" ;
Tarde => "da tarde" ;
Noite => "da noite" ;
None => ""
} ;
a : Number => Str ;
a = numForms "à" "às" ;
lin
weekdayPunctualAdv w = lin Adv {s = w.s ! C.Sg} ; -- lundi weekdayPunctualAdv w = lin Adv {s = w.s ! C.Sg} ; -- lundi
weekdayHabitualAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det w) ; -- il lunedí ---- weekdayHabitualAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det w) ; -- il lunedí ----
weekdayLastAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det (mkCN (mkA "passado") w)) ; -- il lunedí scorso weekdayLastAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det (mkCN (mkA "passado") w)) ; -- il lunedí scorso