summaryrefslogtreecommitdiff
path: root/examples/sammie/SammieI.gf
blob: 0d595b79cadc3354aa86cb5bc4175f8b410b98c0 (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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
--# -path=.:alltenses

incomplete concrete SammieI of Sammie = open 
  Syntax, 
  Symbolic,
  ParamSammie 
in {

flags startcat=Action;

param SetForm = Any | All ;

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

oper mkSet : CN -> Set = \x -> { s = table {
       Any => variants {
         mkNP someSg_Det x ;
         mkNP a_Art x
         } ;
       All => 
         mkNP all_Predet (mkNP all_art plNum x)   
       } 
     } ;

oper mkSetAdj : CN -> A -> Set = \x, adj -> 
  mkSet (mkCN adj x) ;

oper optional : Str -> Str = \s -> [] | s ;

oper song = mkCN (song_N | track_N) ;
oper album = mkCN (album_N | record_N | cd_N) ;

oper command : Utt -> Phr = \s -> 
    mkPhr s 
  | mkPhr s please_Voc 
  | mkPhr please_PConj s ; 

  withGenre : CN -> CN -> Set = \x,y -> 
    mkSet (typeWithGenre x y) ;

  withGenreBy : CN -> NP -> CN -> Set = \x,z,y -> 
    mkSet (mkCN (typeWithGenre x y) (mkAdv artist_Prep z)) ;

----

lincat 
  Action = Phr ;

  Object, Playlist, Artist, Album, Song = NP ;

  PlaylistName, ArtistName, AlbumName, SongName = PN ;

  PlaylistSet, ArtistSet, AlbumSet, SongSet = Set ;

  ToIdentify = QS ;

  Genre = CN ;

  Number = Card ;

lin
  -- Action

  add_song_to_playlist l o = 
    command (imperative (mkVP add_V3 o l)) ;

  create = 
    command 
      (imperative (mkVP create_V2 
        (mkNP a_Art (mkCN new_A playlist_N)))) ;

  dialog_pause = 
    command (imperative ( shutup_VP)) ;
  
  go_back_in_display_history = 
    command (
      mkUtt back_Adv |
      imperative goback_VP
      ) ;

  help = 
    command (imperative goback_VP) ;

  -- tell me
  identify x = 
    command (
      mkUtt x |
      imperative (mkVP tell_V2Q (mkNP i_Pron) x)
      ) ;

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

  make_completion x = command (mkUtt x) ;

  pause = 
    command (imperative pause_VP) ;

  play x = 
    command (imperative (mkVP play_V2 x)) ;

  please_repeat = command what_say ;

  reject_any_constraint_determination = 
    command (whatever_Utt) ;

  remove l o = 
    command (imperative (mkVP remove_V3 o l)) ;

  resume = 
    command (imperative resume_VP) ;

  -- show me

  show x = 
    command (
      imperative (mkVP show_V2Q (mkNP i_Pron) x)
      ) ;

  show_main_menu = 
    command (
        imperative (mkVP show_V3 (mkNP i_Pron) mainmenu_NP)
      | imperative (mkVP return_V2 mainmenu_NP)
      ) ;

  skip_backward = 
    command (
        imperative (mkVP play_V2 (previous song))
      | imperative (mkVP goto_V2 (previous song))
    ) ;

  skip_forward = 
    command (variants {
        imperative (mkVP play_V2 (next song))
      | imperative (mkVP goto_V2 (next song))
      }
    ) ;

  stop = command (imperative (mkVP stop_V)) ;

  -- ToIdentify

  artist_of_album album = 
    mkQS past.p1 past.p2 
      (mkQCl whoSg_IP (mkVP (record_V2 | make_V2) album)) ;

  artist_of_song song = 
    mkQS past.p1 past.p2 (mkQCl whoSg_IP (mkVP record_V2 song)) ;

  currently_playing_object = 
    mkQS (WhatName (this song)) ;

  resource_by_type x = 
    mkQS (WhatName x) ; 

  -- Object

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

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

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


  -- PlaylistSet

  playlists_all = mkSet (mkCN playlist_N) ;
  playlists_by_genre = withGenre (mkCN playlist_N) ;

  -- Playlist

  playlist_this = this (mkCN playlist_N) ;

  playlist_number x = 
    symb (mkCN playlist_N) x ;
  playlist_name x = 
    mkNP the_Art (mkCN (mkCN playlist_N) (mkNP x)) ;

  -- ArtistSet

  artists_all = mkSet (mkCN artist_N) ;

  -- Artist

  artist_this = this (mkCN artist_N) ;

  artist_name x =
      mkNP x
    | mkNP the_Art (mkCN (mkCN artist_N) (mkNP x))
    ;

  -- AlbumSet

  albums_all = mkSet album ;
  albums_by_artist artist = 
    mkSet (mkCN album (mkAdv artist_Prep artist)) ;

  albums_by_genre = withGenre album ; 

  albums_by_artist_genre = withGenreBy album ;

  -- Album

  album_this =
    this album ; 

  album_number x = 
      mkNP the_Art (mkCN album (symb (mkCN number_N) x))
    | symb album x
    ;

  album_name x = 
      mkNP x
    | mkNP the_Art (mkCN album (mkNP x))
    ;

  album_name_artist x y = 
    mkNP 
      (mkNP x | mkNP the_Art (mkCN album (mkNP x)))
      (mkAdv artist_Prep y) ;

  -- SongSet

  songs_all = 
    mkSet song ;

  songs_by_artist artist = 
    mkSet (mkCN song (mkAdv artist_Prep artist)) ;
  songs_by_genre = 
    withGenre song ; 
  songs_by_album album = 
    mkSet (mkCN song (mkAdv from_Prep album)) ;
  songs_by_artist_genre = 
    withGenreBy song ; 

  -- Song

  song_this = this song ; 
  song_name x = 
      mkNP x
    | mkNP the_Art (mkCN song (mkNP x))
    ;
  song_name_artist x y = 
    mkNP 
      (mkNP x | mkNP the_Art (mkCN song (mkNP x)))
      (mkAdv artist_Prep y) ;

  -- Ordinal

  num_1 = mkCard n1_Numeral ;
  num_2 = mkCard n2_Numeral ;
  num_3 = mkCard n3_Numeral ;



  -- Music database

  -- PlaylistName

  CoolHits = name ["cool_hits"] ;
--  Romantik = { s = ["romance"] };

  -- Artist

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

  -- Genre

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

  -- AlbumName
  
  HowToDismantleAnAtomicBomb = name ["how_to_dismantle_an_atomic_bomb"];

  -- SongName

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

}