add more time expressions to ConstructionJpn, and fill SymbolJpn (might be wrong though) functions.

This commit is contained in:
Inari Listenmaa
2017-07-04 16:22:37 +02:00
parent a66b142848
commit fb95d5103c
4 changed files with 113 additions and 65 deletions

View File

@@ -0,0 +1,5 @@
--# -path=.:../japanese:../common:../abstract:../prelude
resource SymbolicJpn = Symbolic with
(Symbol = SymbolJpn),
(Grammar = GrammarJpn) ;

View File

@@ -1,5 +1,5 @@
concrete ConstructionJpn of Construction = CatJpn ** concrete ConstructionJpn of Construction = CatJpn **
open SyntaxJpn, ParadigmsJpn, (R=ResJpn), (L = LexiconJpn) in { open SyntaxJpn, ParadigmsJpn, (R=ResJpn), (L = LexiconJpn), SymbolicJpn in {
lin lin
hungry_VP = mkVP (mkV "お腹が空いている" R.Gr1) ; hungry_VP = mkVP (mkV "お腹が空いている" R.Gr1) ;
@@ -11,50 +11,71 @@ lin
lincat lincat
--TODO add rest as soon as I learn that stuff in Duolingo ^^ /IL 2017-07 Timeunit = N ;
-- Timeunit ;
Weekday = N ; Weekday = N ;
-- Month ; Monthday = NP ;
-- Monthday ; Month = N ;
-- Year ; Year = NP ;
lin lin
-- : Weekday -> Adv ;
weekdayPunctualAdv w = SyntaxJpn.mkAdv in_Prep (mkNP w) ; -- on Sunday weekdayPunctualAdv w = SyntaxJpn.mkAdv in_Prep (mkNP w) ; -- on Sunday
weekdayHabitualAdv w = SyntaxJpn.mkAdv in_Prep (mkNP w) ; -- on Sundays weekdayHabitualAdv w = SyntaxJpn.mkAdv in_Prep (mkNP w) ; -- on Sundays
weekdayNextAdv w = SyntaxJpn.mkAdv in_Prep (mkNP (mkCN (mkA "次の") w)) ; -- next Sunday weekdayNextAdv w = SyntaxJpn.mkAdv in_Prep (mkNP (mkCN (mkA "次の") w)) ; -- next Sunday
weekdayLastAdv w = SyntaxJpn.mkAdv in_Prep (mkNP (mkCN (mkA "先週の") w)) ; -- last Sunday weekdayLastAdv w = SyntaxJpn.mkAdv in_Prep (mkNP (mkCN (mkA "先週の") w)) ; -- last Sunday
{- -- : Month -> Adv ; -- in June
monthAdv : Month -> Adv ; -- in June monthAdv m = SyntaxJpn.mkAdv in_Prep (mkNP m) ;
yearAdv : Year -> Adv ; -- in 1976
dayMonthAdv : Monthday -> Month -> Adv ; -- on 17 May -- : Year -> Adv ; -- in 1976
monthYearAdv : Month -> Year -> Adv ; -- in May 2013 yearAdv y = SyntaxJpn.mkAdv in_Prep y ;
dayMonthYearAdv : Monthday -> Month -> Year -> Adv ; -- on 17 May 2013
-- : Monthday -> Month -> Adv ; -- on 17 May / 五月十七日に
intYear : Int -> Year ; -- (year) 1963 dayMonthAdv day month =
intMonthday : Int -> Monthday ; -- 31th (March) let futsukaNi : Adv = SyntaxJpn.mkAdv in_Prep day ;
-} sangatsu : R.Style => Str = month.s ! R.Sg ;
in futsukaNi ** { s = \\style => sangatsu ! style ++ futsukaNi.s ! style } ;
-- : Month -> Year -> Adv ; -- in May 2013
monthYearAdv m y = SyntaxJpn.mkAdv in_Prep (mkNP (mkCN m y)) ;
-- : Monthday -> Month -> Year -> Adv ; -- on 17 May 2013
dayMonthYearAdv d m y =
let futsukaNi : Adv = SyntaxJpn.mkAdv in_Prep d ;
sangatsu2013 : R.Style => Str = \\st => y.s ! st ++ "年" ++ m.s ! R.Sg ! st;
in futsukaNi ** { s = \\style => sangatsu2013 ! style ++ futsukaNi.s ! style } ;
-- : Int -> Year ; -- (year) 1963
intYear = symb ;
-- : Int -> Monthday ; -- 31th (March)
intMonthday i = symb { s = i.s ++ "日" } ;
-- coercions to RGL categories -- coercions to RGL categories
-- : Weekday -> N ; -- (this) Monday
weekdayN w = w ; weekdayN w = w ;
monthN m = m ;
{- weekdayPN w = mkPN (w.s ! R.Sg ! R.Plain) ;
monthN : Month -> N ; -- (this) November monthPN m = mkPN (m.s ! R.Sg ! R.Plain) ;
weekdayPN : Weekday -> PN ; -- Monday (is free)
monthPN : Month -> PN ; -- March (is cold)
languageNP : Language -> NP ; -- French (is easy)
languageCN : Language -> CN ; -- (my) French
-}
---------------------------------------------- ----------------------------------------------
---- lexicon of special names ---- lexicon of special names
-- This is pure guessing /IL 2017-07
-- second_Timeunit = mkN "second" ;
-- minute_Timeunit = mkN "minute" ;
-- hour_Timeunit = mkN "hour" ;
day_Timeunit = mkN "日" ;
week_Timeunit = mkN "週間" ;
month_Timeunit = mkN "箇月" ;
year_Timeunit = mkN "年" ;
monday_Weekday = mkN "月曜日" ; -- "getsuyoubi" monday_Weekday = mkN "月曜日" ; -- "getsuyoubi"
tuesday_Weekday = mkN "火曜日" ; -- "kayoubi" tuesday_Weekday = mkN "火曜日" ; -- "kayoubi"
wednesday_Weekday = mkN "水曜日" ; -- "suiyoubi" wednesday_Weekday = mkN "水曜日" ; -- "suiyoubi"
@@ -63,4 +84,17 @@ lin
saturday_Weekday = mkN "土曜日" ; -- "doyoubi" saturday_Weekday = mkN "土曜日" ; -- "doyoubi"
sunday_Weekday = mkN "日曜日" ; -- "nichiyoubi" sunday_Weekday = mkN "日曜日" ; -- "nichiyoubi"
january_Month = mkN "一月" ; -- ichigatsu
february_Month = mkN "二月" ; -- nigatsu
march_Month = mkN "三月" ; -- sangatsu
april_Month = mkN "四月" ; -- shigatsu
may_Month = mkN "五月" ; -- gogatsu
june_Month = mkN "六月" ; -- rokugatsu
july_Month = mkN "七月" ; -- shichigatsu
august_Month = mkN "八月" ; -- hachigatsu
september_Month = mkN "九月" ; -- kugatsu
october_Month = mkN "十月" ; -- jyuugatsu
november_Month = mkN "十一月" ; -- jyuuichigatsu
december_Month = mkN "十二月" ; -- jyuunigatsu
} }

View File

@@ -147,7 +147,17 @@ oper
} ; } ;
dropNaEnging = ooki dropNaEnging = ooki
} ; } ;
-- Added by IL 2017-07. Used in NounJpn and SymbolJpn.
mkOrd : SS -> Adj = \symb -> {
pred = \\st,t,p => symb.s ++ "番目" ++ mkCopula.s ! st ! t ! p ; -- "banme"
attr = symb.s ++ "番目の" ;
te = \\p => symb.s ++ "番目" ++ mkCopula.te ! p ;
ba = \\p => symb.s ++ "番目" ++ mkCopula.ba ! p ;
adv = \\p => symb.s ++ "番目" ;
dropNaEnging = symb.s ++ "番目の"
} ;
VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno -> VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno ->
let let
kekkonshite = Predef.tk 2 kekkonshiteiru kekkonshite = Predef.tk 2 kekkonshiteiru

View File

@@ -1,39 +1,40 @@
--# -path=.:../abstract:../prelude --# -path=.:../abstract:../prelude
concrete SymbolJpn of Symbol = CatJpn ** open Prelude, ResJpn in { concrete SymbolJpn of Symbol = CatJpn ** open Prelude, ResJpn, NounJpn in {
flags coding = utf8; flags coding = utf8;
{-
lin
SymbPN i = {s = addGenitiveS i.s ; g = Masc ; t = NonLiving ; h = Pers3_L } ;
IntPN i = {s = addGenitiveS i.s ; g = Masc ; t = NonLiving ; h = Pers3_L } ;
FloatPN i = {s = addGenitiveS i.s ; g = Masc ; t = NonLiving ; h = Pers3_L } ;
NumPN i = {s = \\_ =>i.s ; g = Masc ; t = NonLiving ; h = Pers3_L } ;
CNIntNP cn i = {
s = \\c => cn.s ! Sg ! Nom ++ i.s ;
a = agrP3 cn.g Sg ;
t = NonLiving
} ;
CNSymbNP det cn xs = {
s = \\c => det.s!Sg!Masc ++ cn.s ! det.n ! Nom ++ xs.s ;
a = agrP3 cn.g det.n ;
t = NonLiving
} ;
CNNumNP cn i = {
s = \\c => cn.s ! Sg ! Nom ++ i.s ;
a = agrP3 cn.g Sg ;
t = NonLiving
} ;
SymbS sy = sy ; lin
SymbNum sy = { s = sy.s ; n = Pl } ; --PN = {s : Style => Str ; anim : Animateness} ;
SymbOrd sy = { s = sy.s ++ "ौँ" ; n = Pl} ; SymbPN i = {s = \\style => i.s ; anim = Inanim } ;
IntPN i = {s = \\style => i.s ; anim = Inanim } ;
FloatPN i = {s = \\style => i.s ; anim = Inanim } ;
NumPN i = {s = \\style => i.s ; anim = Inanim } ;
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
CNSymbNP det cn xs =
let np = DetCN det cn ;
in np ** { s = \\st => xs.s ++ "の" ++ np.s ! st } ;
-- : CN -> Card -> NP ; -- level five ; level 5
-- This is pure guessing /IL 2017-07
CNNumNP cn i =
let np = MassNP cn ;
in np ** { s = \\st => i.s ++ "の" ++ np.s ! st } ;
-- S = {s, te, ba, subj : Particle => Style => Str ; pred, pred_te, pred_ba : Style => Str} ;
SymbS sy = { s = \\p,st => sy.s ;
te = \\_,_ => [] ; ba = \\_,_ => [] ; subj = \\_,_ => [] ;
pred = \\st => [] ; pred_te = \\st => [] ; pred_ba = \\st => [] } ;
SymbNum sy = mkNum sy.s Pl ;
SymbOrd = mkOrd ;
lincat lincat
@@ -42,13 +43,11 @@ lincat
lin lin
MkSymb s = s ; MkSymb s = s ;
BaseSymb = infixSS "" ; BaseSymb = infixSS "" ;
ConsSymb = infixSS "," ; ConsSymb = infixSS "," ;
oper -- level 53 (covered by CNNumNP)
-- Note: this results in a space before 's, but there's --CNIntNP cn i = {} ;
-- not mauch we can do about that.
addGenitiveS : Str -> Case => Str = \s ->
table {_ => Prelude.glue s "दा" } ;
-}
} }