summaryrefslogtreecommitdiff
path: root/examples/sammie/SammieEng1.gf
blob: adc541e79edbb3f5a83d7fb5d5d4d4d72b0fa285 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

concrete SammieEng1 of Sammie = {

flags startcat=Action;

param SetForm = Any | All;

oper Set = { s : SetForm => Str } ;

oper mkSet : Str -> Set = \x -> { s = table {
       Any => variants { "a"; "some"; "any" } ++ x ;
       All => variants { "all"; ["all the"] } ++ (x + "s")
       } } ;

oper mkSetAdj : Str -> Str -> Set = \x -> \adj -> { s = table {
       Any => variants { "a"; "some"; "any" } ++ adj ++ x ;
       All => variants { "all"; ["all the"] } ++ adj ++ (x + "s")
       } } ;

oper optional : Str -> Str = \s -> variants { []; s } ;

oper song = variants {"song"; "track"} ;
oper album = variants {"album";"record";"cd"} ;

oper command : Str -> { s : Str } = 
       \s -> { s = variants {s; "please" ++ s; s ++ "please" } } ;


lincat 
  PlaylistSet, ArtistSet, AlbumSet, SongSet = Set ;


lin
  -- Action

  add_song_to_playlist l o = 
    command ("add" ++ o.s ++ "to" ++ l.s) ;

  -- create a new playlist
  create = 
    command ["create a new playlist"] ;

  dialog_pause = 
    command (variants {
	       ["pause the dialog"]; 
	       ["be"] ++ variants { "quiet";"silent" };
	       ["shut"] ++ variants {[]; ["the hell"]; ["the fuck"]} ++ "up";
	       ["shut your mouth"];
	       ["put a sock in it"];
	       });
  
  go_back_in_display_history = 
    command (variants { ["back"]; ["go back"] }) ;

  help = 
    command (variants { ["help"]; ["help me"]; ["give me help"] }) ;

  -- tell me
  identify x = 
    command (optional ["tell me"] ++ x.s) ;

--  identify_songlist_of_album x = command (x.s) ;

  make_completion x = command (x.s) ;

  pause = 
    command "pause" ;

  play x = 
    command ("play" ++ x.s) ;

  please_repeat = 
    command (variants {
	       ["repeat that"];
	       ["what"];
	       ["pardon"];
	       ["pardon me"];
	       ["what did you say"];
	       ["what was that"]
	       }) ;

  -- I don't care
  reject_any_constraint_determination = 
    command (variants {
	       ["whatever"];
	       variants {["do i look like i"];["i don't"]}
		 ++ variants {["give a"] ++ variants {"shit";"fuck";["rat's ass"]};
			      ["care"]}
		 ++ optional ["about that"];
	       ["i couldn't care less"];
	       ["see if i care"]
	       }) ;

  remove l o = 
    command ("remove" ++ o.s ++ "from" ++ l.s) ;

  resume = 
    command ("resume") ;

  -- show me

  show x = 
    command (["show me"] ++ x.s) ;

  show_main_menu = 
    command (variants { 
	       ["show me the main menu"]; 
	       ["go to the main menu"];
	       ["back to the main menu"];
	       }) ;

  skip_backward = 
    command (variants {"play"; ["go to"]} ++ ["the previous"] ++ song) ;

  skip_forward = 
    command (variants {"play"; ["go to"]} ++ ["the next"] ++ song) ;

  stop = command (variants { "stop" }) ;

  -- ToIdentify

  artist_of_album album = 
    { s = "who" ++ variants {"made";"sings";"plays";"recorded"} ++ album.s } ;

  artist_of_song song = 
    { s = "who" ++ variants {"made";"sings";"plays";"recorded"} ++ song.s } ;

  currently_playing_object = 
    { s = variants {
	["what is this"] ++ optional song ++ ["called"];
	["what is the name of this"] ++ optional song;
	} } ;

  resource_by_type x = { s = x.s } ;

  -- Object

  one_song x = { s = x.s } ;
  any_song x = { s = x.s ! Any} ;
  all_songs x = { s = x.s ! All } ;

  one_album x = { s = x.s } ;
  any_album x = { s = x.s ! Any} ;
  all_albums x = { s = x.s ! All } ;

  one_playlist x = { s = x.s } ;
  any_playlist x = { s = x.s ! Any} ;
  all_playlists x = { s = x.s ! All } ;


  -- PlaylistSet

  playlists_all = mkSet "playlist" ;
  playlists_by_genre genre = mkSetAdj "playlist" (genre.s) ;

  -- Playlist

  playlist_this = { s = ["this playlist"] } ;
  playlist_number x = { s = "playlist" ++ x.s } ;
  playlist_name x = { s = variants { ["the playlist"] ++ x.s; "the" ++ x.s ++ "playlist" }};

  -- ArtistSet

  artists_all = mkSet "artist" ;

  -- Artist

  artist_this = { s = ["this artist"] } ;
  artist_name x = { s = optional ["the artist"] ++ x.s } ;

  -- AlbumSet

  albums_all = mkSet album ;
  albums_by_artist artist = { s = \\n => (mkSet album).s ! n ++ "by" ++ artist.s };
  albums_by_genre genre = mkSetAdj album (genre.s) ;
  albums_by_artist_genre artist genre = { s = \\n => (mkSetAdj album (genre.s)).s ! n ++ "by" ++ artist.s };

  -- Album

  album_this = { s = ["this"] ++ album } ;
  album_number n = { s = album ++ ["number"] ++ n.s } ;
  album_name name = { s = optional (["the"] ++ album) ++ name.s } ;
  album_name_artist name artist = { s = optional (["the"] ++ album) ++ name.s ++ "by" ++ artist.s } ;

  -- SongSet

  songs_all = mkSet song ;
  songs_by_artist artist = { s = \\n => (mkSet song).s ! n ++ "by" ++ artist.s };
  songs_by_genre genre = mkSetAdj song (genre.s) ;
  songs_by_album album = { s = \\n => (mkSet song).s ! n ++ "from" ++ album.s } ;
  songs_by_artist_genre artist genre = { s = \\n => (mkSetAdj song (genre.s)).s ! n ++ "by" ++ artist.s };

  -- Song

  song_this = { s = "this" ++ song } ;
  song_name x = { s = optional ("the" ++ song) ++ x.s } ;
  song_name_artist name artist = { s =  optional ("the" ++ song) ++ name.s ++ "by" ++ artist.s } ;

  -- Ordinal

--  num_1 = { s = "one" } ;
  num_2 = { s = "two" } ;
--  num_3 = { s = "three" } ;



  -- Music database

  -- PlaylistName

  CoolHits = { s = ["cool hits"] };
--  Romantik = { s = ["romance"] };

  -- Artist

--  Falco = { s = ["Falco"] };
--  TheBeatles = { s = ["The Beatles"] };
  U2 = { s = "u2" } ;

  -- Genre

--  Pop = { s = ["pop"] };
  Rock = { s = ["rock"] };

  -- AlbumName
  
  HowToDismantleAnAtomicBomb = { s = ["how to dismantle an atomic bomb"] };

  -- SongName

--  AHardDaysNight = { s = ["a hard day's night"] };
--  LetItBe = { s = ["let it be"] };
  Vertigo = { s = "vertigo" } ;

}