mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -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
|
||||
|
||||
DateTime ;
|
||||
|
||||
Date ;
|
||||
Year ;
|
||||
Month ;
|
||||
MonthName ;
|
||||
Day ;
|
||||
|
||||
Time ;
|
||||
Hour ;
|
||||
Minute ;
|
||||
@@ -16,9 +21,11 @@ Weekday ;
|
||||
|
||||
fun
|
||||
|
||||
DateTimeDateTime : Date -> Time -> DateTime ;
|
||||
|
||||
WeekdayDate : Weekday -> Date ; -- Monday
|
||||
WeekdayTimeDate : Weekday -> Time -> Date ; -- Monday at twenty past two
|
||||
MonthDayDate : MonthName -> Day -> Date ; -- the third of March
|
||||
MonthDate : MonthName -> Date ; -- March
|
||||
YearDate : Year -> Date ; -- two thousand eight
|
||||
YearMonthDate : Year -> MonthName -> Date ; -- March 1995
|
||||
YearMonthDayDate : Year -> MonthName -> Day -> Date ; -- January 1st, 2006
|
||||
@@ -67,6 +74,12 @@ friday : Weekday ;
|
||||
saturday : Weekday ;
|
||||
sunday : Weekday ;
|
||||
|
||||
-- Date and time adverbs
|
||||
|
||||
fun
|
||||
OnDate : Date -> Adv ;
|
||||
AtTime : Time -> Adv ;
|
||||
|
||||
{-
|
||||
Add:
|
||||
|
||||
@@ -83,26 +96,6 @@ the day after tomorrow, in x days, x days ago
|
||||
|
||||
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
|
||||
concrete TimeEng of Time = NumeralEng **
|
||||
concrete TimeEng of Time = CatEng, NumeralEng **
|
||||
open Prelude, CatEng, ParadigmsEng, ResEng in {
|
||||
|
||||
param DateType = YearMonthType | DayType ;
|
||||
|
||||
lincat
|
||||
Date = SS ;
|
||||
DateTime = SS ;
|
||||
|
||||
Date = { s : Str; t : DateType } ;
|
||||
Year = SS;
|
||||
Month = SS ;
|
||||
MonthName = SS ;
|
||||
@@ -14,14 +18,19 @@ Minute = SS ;
|
||||
Time = SS ;
|
||||
|
||||
lin
|
||||
WeekdayDate day = ss (day.s ! singular ! nominative) ;
|
||||
WeekdayTimeDate day time = ss (day.s ! singular ! nominative ++ "at" ++ time.s) ;
|
||||
MonthDayDate month day = variants { ss ("the" ++ day.s ++ "of" ++ month.s);
|
||||
ss (month.s ++ day.s) } ;
|
||||
YearDate year = ss (year.s) ;
|
||||
YearMonthDate year month = ss (month.s ++ year.s) ;
|
||||
YearMonthDayDate year month day = variants { ss ("the" ++ day.s ++ "of" ++ month.s ++ "," ++ year.s);
|
||||
ss (month.s ++ day.s ++ "," ++ year.s) } ;
|
||||
|
||||
DateTimeDateTime date time = { s = date.s ++ "at" ++ time.s };
|
||||
|
||||
WeekdayDate day = { s = day.s ! singular ! nominative; t = DayType } ;
|
||||
MonthDayDate month day = { s = variants { "the" ++ day.s ++ "of" ++ month.s;
|
||||
month.s ++ day.s } ;
|
||||
t = DayType } ;
|
||||
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} ;
|
||||
@@ -66,4 +75,13 @@ friday = mkN "Friday" ;
|
||||
saturday = mkN "Saturday" ;
|
||||
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