trams with mm library

This commit is contained in:
aarne
2005-11-07 21:45:22 +00:00
parent f6d064d9f7
commit 9388b1f189
14 changed files with 179 additions and 46 deletions

15
examples/tram/README Normal file
View File

@@ -0,0 +1,15 @@
Björn Bringert's tram grammars (user side, without place names)
implemented as an example of lib/resource/abstract/Multimodal.
For documentation of the original system, see
http://www.cs.chalmers.se/~bringert/gf/tramdemo.html
To try, do in gf
i -src TramEng.gf
gr | l -tr | p
Clicks appear as coordinates on the right of the semicolon.
AR 7/11/2005.

33
examples/tram/Tram.gf Normal file
View File

@@ -0,0 +1,33 @@
abstract Tram = {
cat
Dep ; -- from here, from Angered
Dest ; -- to here, to Angered
Query ; -- message sent to the dialogue manager: sequentialized
Input ; -- user input: parallel text and clicks
Click ; -- map clicks
fun
QInput : Input -> Query ; -- sequentialize user input
fun
GoFromTo : Dep -> Dest -> Input ; -- user input "want to go from a to b"
GoToFrom : Dest -> Dep -> Input ; -- user input "want to go to a from b"
ComeFrom : Dep -> Input ; -- user input "want to come from x (to where I am now)
GoTo : Dest -> Input ; -- user input "want to go to x (from where I am now)
DepClick : Click -> Dep ; -- "from here" with click
DestClick : Click -> Dest ; -- "to here" with click
DepHere : Dep ; -- "from here" indexical
DestHere : Dest ; -- "to here" indexical
DepNamed : String -> Dep ; -- from a place name
DestNamed : String -> Dest ; -- to a place name
CCoord : Int -> Int -> Click ;
--- the syntax of here (prep + adverb, not prep + np) prevent these
-- Place ; -- any way to identify a place: name, click, or indexical "here"
-- PClick : Click -> Place ; -- click associated with a "here"
-- PHere : Place ; -- indexical "here", without a click
}

5
examples/tram/TramEng.gf Normal file
View File

@@ -0,0 +1,5 @@
--# -path=.:resource/abstract:resource/english:prelude
concrete TramEng of Tram = TramI with
(Multimodal = MultimodalEng),
(Math = MathEng) ;

5
examples/tram/TramFre.gf Normal file
View File

@@ -0,0 +1,5 @@
--# -path=.:resource/abstract:resource/french:resource/romance:prelude
concrete TramFre of Tram = TramI with
(Multimodal = MultimodalFre),
(Math = MathFre) ;

44
examples/tram/TramI.gf Normal file
View File

@@ -0,0 +1,44 @@
incomplete concrete TramI of Tram = open Multimodal, Math in {
flags startcat=Query ; lexer=textlit ;
lincat
Dep, Dest = DAdv ;
Query = Phr ; -- top level, plain string
Input = MS ; -- two parallel sequences (text and clicks)
Click = Point ;
lin
QInput i = SentMS PPos i ;
GoFromTo x y =
ModDemV want_VV go_V (DemNP i_NP)
(ConsDAdv x (ConsDAdv y BaseDAdv)) ;
GoToFrom x y =
ModDemV want_VV go_V (DemNP i_NP)
(ConsDAdv x (ConsDAdv y BaseDAdv)) ;
ComeFrom x =
ModDemV want_VV come_V (DemNP i_NP)
(ConsDAdv x BaseDAdv) ;
GoTo x =
ModDemV want_VV go_V (DemNP i_NP)
(ConsDAdv x BaseDAdv) ;
DepClick c = here7from_DAdv c ;
DestClick c = here7to_DAdv c ;
DepHere = DemAdv here7from_Adv ;
DestHere = DemAdv here7to_Adv ;
DepNamed s = PrepDNP from_Prep (DemNP (UsePN (SymbPN s))) ;
DestNamed s = PrepDNP to_Prep (DemNP (UsePN (SymbPN s))) ;
CCoord x y = {s5 = "(" ++ x.s ++ "," ++ y.s ++ ")" ; lock_Point = <>} ;
-- Place = DNP ; -- name + click - not possible for "here"
-- PClick c = this_DNP c ;
-- PHere = DemNP this_NP ;
-- PNamed s = DemNP (UsePN (SymbPN s)) ;
}

5
examples/tram/TramSwe.gf Normal file
View File

@@ -0,0 +1,5 @@
--# -path=.:resource/abstract:resource/swedish:resource/scandinavian:prelude
concrete TramSwe of Tram = TramI with
(Multimodal = MultimodalSwe),
(Math = MathSwe) ;