mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-24 02:12:50 -06:00
Added some adverbials to Time.
This commit is contained in:
@@ -1,14 +1,19 @@
|
|||||||
abstract Time = Numeral ** {
|
abstract Time = Cat, Numeral ** {
|
||||||
|
|
||||||
-- Time grammar Abstract syntax. Modified by AR from Karin Cavallin.
|
-- Time grammar Abstract syntax. Modified by BB and AR from Karin Cavallin.
|
||||||
|
|
||||||
|
-- Dates and times
|
||||||
|
|
||||||
cat
|
cat
|
||||||
|
|
||||||
|
DateTime ;
|
||||||
|
|
||||||
Date ;
|
Date ;
|
||||||
Year ;
|
Year ;
|
||||||
Month ;
|
Month ;
|
||||||
MonthName ;
|
MonthName ;
|
||||||
Day ;
|
Day ;
|
||||||
|
|
||||||
Time ;
|
Time ;
|
||||||
Hour ;
|
Hour ;
|
||||||
Minute ;
|
Minute ;
|
||||||
@@ -16,9 +21,11 @@ Weekday ;
|
|||||||
|
|
||||||
fun
|
fun
|
||||||
|
|
||||||
|
DateTimeDateTime : Date -> Time -> DateTime ;
|
||||||
|
|
||||||
WeekdayDate : Weekday -> Date ; -- Monday
|
WeekdayDate : Weekday -> Date ; -- Monday
|
||||||
WeekdayTimeDate : Weekday -> Time -> Date ; -- Monday at twenty past two
|
|
||||||
MonthDayDate : MonthName -> Day -> Date ; -- the third of March
|
MonthDayDate : MonthName -> Day -> Date ; -- the third of March
|
||||||
|
MonthDate : MonthName -> Date ; -- March
|
||||||
YearDate : Year -> Date ; -- two thousand eight
|
YearDate : Year -> Date ; -- two thousand eight
|
||||||
YearMonthDate : Year -> MonthName -> Date ; -- March 1995
|
YearMonthDate : Year -> MonthName -> Date ; -- March 1995
|
||||||
YearMonthDayDate : Year -> MonthName -> Day -> Date ; -- January 1st, 2006
|
YearMonthDayDate : Year -> MonthName -> Day -> Date ; -- January 1st, 2006
|
||||||
@@ -67,6 +74,12 @@ friday : Weekday ;
|
|||||||
saturday : Weekday ;
|
saturday : Weekday ;
|
||||||
sunday : Weekday ;
|
sunday : Weekday ;
|
||||||
|
|
||||||
|
-- Date and time adverbs
|
||||||
|
|
||||||
|
fun
|
||||||
|
OnDate : Date -> Adv ;
|
||||||
|
AtTime : Time -> Adv ;
|
||||||
|
|
||||||
{-
|
{-
|
||||||
Add:
|
Add:
|
||||||
|
|
||||||
@@ -83,26 +96,6 @@ the day after tomorrow, in x days, x days ago
|
|||||||
|
|
||||||
relative time: in x minutes, in x hours
|
relative time: in x minutes, in x hours
|
||||||
|
|
||||||
temporal adverbs:
|
|
||||||
|
|
||||||
point:
|
|
||||||
|
|
||||||
- in 1992
|
|
||||||
- in July
|
|
||||||
- in July 1992
|
|
||||||
- on Monday
|
|
||||||
- on the first of July
|
|
||||||
- on the first of July, 1992
|
|
||||||
- on Monday at two twenty
|
|
||||||
|
|
||||||
starting:
|
|
||||||
|
|
||||||
- from (all of the above)
|
|
||||||
|
|
||||||
ending:
|
|
||||||
|
|
||||||
- to (all of the above)
|
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
--# -path=.:present
|
--# -path=.:present
|
||||||
concrete TimeEng of Time = NumeralEng **
|
concrete TimeEng of Time = CatEng, NumeralEng **
|
||||||
open Prelude, CatEng, ParadigmsEng, ResEng in {
|
open Prelude, CatEng, ParadigmsEng, ResEng in {
|
||||||
|
|
||||||
|
param DateType = YearMonthType | DayType ;
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
Date = SS ;
|
DateTime = SS ;
|
||||||
|
|
||||||
|
Date = { s : Str; t : DateType } ;
|
||||||
Year = SS;
|
Year = SS;
|
||||||
Month = SS ;
|
Month = SS ;
|
||||||
MonthName = SS ;
|
MonthName = SS ;
|
||||||
@@ -14,14 +18,19 @@ Minute = SS ;
|
|||||||
Time = SS ;
|
Time = SS ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
WeekdayDate day = ss (day.s ! singular ! nominative) ;
|
|
||||||
WeekdayTimeDate day time = ss (day.s ! singular ! nominative ++ "at" ++ time.s) ;
|
DateTimeDateTime date time = { s = date.s ++ "at" ++ time.s };
|
||||||
MonthDayDate month day = variants { ss ("the" ++ day.s ++ "of" ++ month.s);
|
|
||||||
ss (month.s ++ day.s) } ;
|
WeekdayDate day = { s = day.s ! singular ! nominative; t = DayType } ;
|
||||||
YearDate year = ss (year.s) ;
|
MonthDayDate month day = { s = variants { "the" ++ day.s ++ "of" ++ month.s;
|
||||||
YearMonthDate year month = ss (month.s ++ year.s) ;
|
month.s ++ day.s } ;
|
||||||
YearMonthDayDate year month day = variants { ss ("the" ++ day.s ++ "of" ++ month.s ++ "," ++ year.s);
|
t = DayType } ;
|
||||||
ss (month.s ++ day.s ++ "," ++ year.s) } ;
|
MonthDate month = { s = month.s ; t = YearMonthType } ;
|
||||||
|
YearDate year = { s = year.s ; t = YearMonthType } ;
|
||||||
|
YearMonthDate year month = { s = month.s ++ year.s; t = YearMonthType } ;
|
||||||
|
YearMonthDayDate year month day = { s = variants { "the" ++ day.s ++ "of" ++ month.s ++ "," ++ year.s;
|
||||||
|
month.s ++ day.s ++ "," ++ year.s };
|
||||||
|
t = DayType } ;
|
||||||
|
|
||||||
|
|
||||||
NumYear n = {s = n.s ! NCard} ;
|
NumYear n = {s = n.s ! NCard} ;
|
||||||
@@ -66,4 +75,13 @@ friday = mkN "Friday" ;
|
|||||||
saturday = mkN "Saturday" ;
|
saturday = mkN "Saturday" ;
|
||||||
sunday = mkN "Sunday" ;
|
sunday = mkN "Sunday" ;
|
||||||
|
|
||||||
|
|
||||||
|
OnDate date = let prep = case date.t of {
|
||||||
|
YearMonthType => "in";
|
||||||
|
DayType => "on"
|
||||||
|
}
|
||||||
|
in { s = prep ++ date.s } ;
|
||||||
|
|
||||||
|
AtTime time = { s = "at" ++ time.s } ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user