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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
--# -path=.:alltenses
---- doesn't compile yet (AR 8/10/2009)
concrete SammieGer2 of Sammie = open
SyntaxGer, ---- should be used
GrammarGer,
ExtraGer,
SymbolGer,
ParadigmsGer,
IrregGer,
(R = ResGer), ----
ConstructX,
Prelude
in {
flags startcat=Action;
param SetForm = Any | All ;
oper Set = { s : SetForm => NP } ;
oper mkSet : CN -> Set = \x -> { s = table {
Any => variants {
DetCN someSg_Det x ;
DetCN (DetSg (SgQuant IndefArt) NoOrd) x
} ;
All =>
PredetNP all_Predet (DetCN (DetPl (PlQuant all_art) NoNum NoOrd) x)
}
} ;
oper mkSetAdj : CN -> A -> Set = \x, adj ->
mkSet (AdjCN (PositA adj) x) ;
oper optional : Str -> Str = \s -> variants { []; s } ;
oper song = UseN (variants {song_N ; track_N}) ;
oper album = UseN (variants {album_N ; record_N ; cd_N}) ;
oper command : Utt -> Phr = \s -> variants {
PhrUtt NoPConj s NoVoc ;
PhrUtt NoPConj s please_Voc ;
PhrUtt please_PConj s NoVoc
} ;
withGenre : CN -> CN -> Set = \x,y ->
mkSet (typeWithGenre x y) ;
withGenreBy : CN -> NP -> CN -> Set = \x,z,y ->
mkSet (AdvCN (typeWithGenre x y) (PrepNP 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 = Num ;
lin
-- Action
add_song_to_playlist l o =
command (imperative PPos (ImpVP (ComplV3 add_V3 o l))) ;
create =
command
(imperative PPos (ImpVP (ComplV2 create_V2
(DetCN (DetSg (SgQuant IndefArt) NoOrd)
(AdjCN (PositA new_A) (UseN playlist_N)))))) ;
dialog_pause =
command (imperative PPos (ImpVP shutup_VP)) ;
go_back_in_display_history =
command (variants {
UttAdv back_Adv ;
imperative PPos (ImpVP goback_VP)
}
) ;
help =
command (imperative PPos (ImpVP goback_VP)) ;
-- tell me
identify x =
command (variants {
UttQS x ;
imperative PPos (ImpVP (AdvVP (ComplV2 tell_V2 (UsePron i_Pron))
(AdvSC (EmbedQS x))))
}
) ;
-- identify_songlist_of_album x = command (x.s) ;
make_completion x = command (UttNP x) ;
pause =
command (imperative PPos (ImpVP pause_VP)) ;
play x =
command (imperative PPos (ImpVP (ComplV2 play_V2 x))) ;
please_repeat = command what_say ;
reject_any_constraint_determination =
command (whatever_Utt) ;
remove l o =
command (imperative PPos (ImpVP (ComplV3 remove_V3 o l))) ;
resume =
command (imperative PPos (ImpVP resume_VP)) ;
-- show me
show x =
command (
imperative PPos (ImpVP (AdvVP (ComplV2 show_V2 (UsePron i_Pron))
(AdvSC (EmbedQS x))))) ;
show_main_menu =
command (variants {
imperative PPos (ImpVP (ComplV3 show_V3 (UsePron i_Pron) mainmenu_NP)) ;
imperative PPos (ImpVP (ComplV2 return_V2 mainmenu_NP))
}
) ;
skip_backward =
command (variants {
imperative PPos (ImpVP (ComplV2 play_V2 (previous song))) ;
imperative PPos (ImpVP (ComplV2 goto_V2 (previous song)))
}
) ;
skip_forward =
command (variants {
imperative PPos (ImpVP (ComplV2 play_V2 (next song))) ;
imperative PPos (ImpVP (ComplV2 goto_V2 (next song)))
}
) ;
stop = command (imperative PPos (ImpVP (UseV stop_V))) ;
-- ToIdentify
artist_of_album album =
UseQCl past.p1 past.p2 PPos (QuestVP whoSg_IP
(variants {ComplV2 record_V2 album ; ComplV2 make_V2 album})) ;
--- { s = "who" ++ variants {"made";"sings";"plays";"recorded"} ++ album.s } ;
artist_of_song song =
UseQCl past.p1 past.p2 PPos (QuestVP whoSg_IP (ComplV2 record_V2 song)) ;
currently_playing_object =
UseQCl TPres ASimul PPos (WhatName
(this song)) ;
{- ---
{ s = variants {
["what is this"] ++ optional song ++ ["called"];
["what is the name of this"] ++ optional song;
} } ;
-}
resource_by_type x = ---T
UseQCl TPres ASimul PPos (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 (UseN playlist_N) ;
playlists_by_genre = withGenre (UseN playlist_N) ;
-- Playlist
playlist_this = this (UseN playlist_N) ;
-- DetCN (DetSg (SgQuant this_Quant) NoOrd) (UseN playlist_N) ;
playlist_number x =
CNNumNP (UseN playlist_N) x ;
playlist_name x =
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN (UseN playlist_N) (UsePN x)) ;
-- ArtistSet
artists_all = mkSet (UseN artist_N) ;
-- Artist
artist_this = this (UseN artist_N) ;
-- DetCN (DetSg (SgQuant this_Quant) NoOrd) (UseN artist_N) ;
artist_name x =variants {
UsePN x ;
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN (UseN artist_N) (UsePN x))
} ;
-- AlbumSet
albums_all = mkSet album ;
albums_by_artist artist =
mkSet (AdvCN album (PrepNP artist_Prep artist)) ;
albums_by_genre = withGenre album ;
albums_by_artist_genre = withGenreBy album ;
-- Album
album_this =
this album ;
album_number x = variants {
CNNumNP (ApposCN album (CNNumNP (UseN number_N) x)) NoNum ;
CNNumNP album x
} ;
album_name x = variants {
UsePN x ;
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN album (UsePN x))
} ;
album_name_artist x y = AdvNP (variants {
UsePN x ;
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN album (UsePN x))
}) (PrepNP artist_Prep y) ;
-- SongSet
songs_all = mkSet song ;
songs_by_artist artist =
mkSet (AdvCN song (PrepNP artist_Prep artist)) ;
songs_by_genre = withGenre song ;
songs_by_album album =
mkSet (AdvCN song (PrepNP from_Prep album)) ;
songs_by_artist_genre = withGenreBy song ;
-- Song
song_this = this song ;
-- DetCN (DetSg (SgQuant this_Quant) NoOrd) song ;
song_name x = variants {
UsePN x ;
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN song (UsePN x))
} ;
song_name_artist x y = AdvNP (variants {
UsePN x ;
DetCN (DetSg (SgQuant DefArt) NoOrd) (ApposCN song (UsePN x))
}) (PrepNP artist_Prep y) ;
-- Ordinal
-- num_1 = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))) ;
num_2 = NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))) ;
-- num_3 = { s = "three" } ;
-- 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 = UseN 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"] ;
-- }
-- instance ParamSammieGer of ParamSammie = open
oper
song_N = variants {
reg2N "lied" "lieder" neuter ;
reg2N "song" "songs" masculine
} ;
track_N = reg2N "stück" "stücke" neuter ;
album_N = mkN "album" "album" "album" "albums" "alben" "alben" neuter ;
record_N = regN "platte" ;
cd_N = reg2N "cd" "cds" feminine ;
playlist_N = variants {
reg2N "playlist" "playlisten" feminine ;
regN "wiedergabeliste"
} ;
artist_N = regN "künstler" ;
number_N = reg2N "nummer" "nummern" feminine ;
rock_N = regN "rock" ;
new_A = regA "neu" ;
add_V3 =
mkV3 (prefixV "hinzu" (regV "fügen")) accPrep zu_Prep ;
remove_V3 =
mkV3 (prefixV "aus" nehmen_V) accPrep (mkPrep "aus" dative) ;
show_V3 = mkV3 (regV "zeigen") datPrep accPrep ;
create_V2 = dirV2 (no_geV (regV (variants {"erzeugen" ; "erstellen"}))) ;
tell_V2 = mkV2 (regV "sagen") datPrep ;
play_V2 = dirV2 (regV "spielen") ;
show_V2 = mkV2 (regV "zeigen") datPrep ;
return_V2 = mkV2 (prefixV "zurück" gehen_V) zu_Prep ;
goto_V2 = mkV2 gehen_V to_Prep ;
record_V2 = dirV2 (no_geV (regV "interpretieren")) ;
--prefixV "ein" (regV "spielen")) ;
make_V2 = dirV2 (regV "machen") ;
stop_V = halten_V ;
back_Adv = mkAdv "zurück" ;
what_IAdv = mkIAdv "was" ;
previous_Ord =
{s = variants {
(regA "vorig").s ! R.Posit ;
(regA "vorhergehend").s ! R.Posit
} ;
lock_Ord = <>
} ;
next_Ord =
{s = variants {
(regA "nächst").s ! R.Posit ;
(regA "nachfolgend").s ! R.Posit
} ;
lock_Ord = <>
} ;
please_PConj = mkPConj "bitte" ;
mainmenu_NP =
DetCN (DetSg (SgQuant DefArt) NoOrd)
(UseN (reg2N "hauptmenü" "hauptmenüs" neuter)) ;
goback_VP = AdvVP (UseV gehen_V) back_Adv ;
shutup_VP = UseV (schweigen_V) ;
pause_VP = UseV (regV "pausieren") ;
resume_VP = UseV (regV "wiederholen") ; ----
whatever_Utt = mkUtt ["irgendwas"] ;
typeWithGenre x genre =
---- CompoundCN genre x ;
AdvCN x (PrepNP with_Prep
(DetCN (DetSg MassDet NoOrd) genre)) ;
name = regPN ;
WhatName x = QuestIAdv how_IAdv (PredVP x (UseV heißen_V)) ;
past = <TPres,AAnter> ;
imperative = variants { UttImpPol ; UttImpSg } ;
previous = DetCN (DetSg (SgQuant DefArt) previous_Ord) ;
next = DetCN (DetSg (SgQuant DefArt) next_Ord) ;
what_say = UttIP whatSg_IP ;
all_art = variants {IndefArt ; DefArt} ;
artist_Prep = variants {by8agent_Prep ; with_Prep} ;
this cn = variants {
DetCN (DetSg (SgQuant this_Quant) NoOrd) cn ;
DetCN (DetSg (SgQuant DefArt) NoOrd)
(AdjCN (PositA (regA "aktuell")) cn)
} ;
-- interface ParamSammie = open Grammar in {
oper
song_N, track_N, album_N, record_N, cd_N,
playlist_N, artist_N, number_N, rock_N : N ;
new_A : A ;
add_V3, remove_V3, show_V3 : V3 ;
create_V2, tell_V2, play_V2, show_V2, return_V2, goto_V2,
record_V2, make_V2 : V2 ;
stop_V : V ;
back_Adv : Adv ;
what_IAdv : IAdv ;
previous_Ord, next_Ord : Ord ;
please_PConj : PConj ;
mainmenu_NP : NP ;
goback_VP : VP ;
shutup_VP : VP ;
pause_VP : VP ;
resume_VP : VP ;
whatever_Utt : Utt ;
typeWithGenre : CN -> CN -> CN ;
name : Str -> PN ;
WhatName : NP -> QCl ;
past : Tense * Ant ;
imperative : Pol -> Imp -> Utt ;
previous, next : CN -> NP ;
what_say : Utt ;
all_art : Quant ;
this : CN -> NP ;
}
|