summaryrefslogtreecommitdiff
path: root/examples/godis-tram/Common/GodisLangEng.gf
blob: 89ecdd585f169961820efbe43883203a8e00863c (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
--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english

instance GodisLangEng of GodisLang = 
    open Prelude, PredefCnc, GrammarEng, ParadigmsEng, (ResEng=ResEng), ParamX, ConstructX, 
         (Lex=LangEng), (Irreg=IrregEng) in {

oper

----------------------------------------------------------------------
-- focus

embed_NP a b x = {s = \\c => a ++ (x.s ! c) ++ b; a = x.a; lock_NP = <>};


----------------------------------------------------------------------
-- user utterances

userGreet = ss ["hello"];
userQuit  = ss (variants{ ["goodbye"]; ["quit"] });
userNo    = ss ["no"];
userYes   = ss ["yes"];
userOkay  = variants { ss ["okay"]; ss ["ok"] };

userCoordinate x y = ss (x.s ++ "and" ++ optStr "then" ++ y.s);

thank_you_Str = variants {["thank you"]; "great"; ["thanks"]};
i_want_to_Str = variants{"i" ++ variants{"want"; ["would like"]} ++ "to";
                         ["can you"]};
please_Str    = "please";
this_that_Str = variants{"this"; "that"};

not_user_prop  p = ss ( not_Predet.s ++ p.s );
not_user_short a = ss ( not_Predet.s ++ a.s );

----------------------------------------------------------------------
-- system utterances

hello           = mkUtt ["The mp3 player is ready to use"];
goodbye         = mkUtt ["Goodbye"];
yes             = mkUtt ["Yes"];
no              = mkUtt ["No"];

is_that_correct_Post   = mkUtt [", is that correct"];
returning_to_Pre       = mkUtt ["Returning to"];
returning_to_act_Pre   = mkUtt ["Returning to"];
returning_to_issue_Pre = mkUtt ["Returning to the issue of"];
what_did_you_say       = mkUtt ["What did you say"];
what_do_you_mean       = mkUtt ["What do you mean"];
i_dont_understand      = mkUtt ["Sorry, I don't quite understand"];
cant_answer_que_Pre    = mkUtt ["Sorry, I can't answer questions about"];
not_valid_Post         = mkUtt ["is not a valid option"];

icm_acc_pos     = variants { mkUtt ["Okay"]; mkUtt thank_you_Str }; 
icm_con_neg     = mkUtt ["Hello?"];
icm_reraise     = mkUtt ["So, "];
icm_loadplan    = mkUtt ["Let's see"];
icm_accommodate = mkUtt ["Alright "];

icm_per_pos   x = mkUtt (["I thought you said"] ++ x.s);


----------------------------------------------------------------------
-- noun phrases

sing_NP    s = ResEng.regNP s Sg ** {lock_NP = <>};
plur_NP    s = ResEng.regNP s Pl ** {lock_NP = <>};

NPgen_NP = NP_of_NP;

NP_Cl np = {s = \\t,a,b,o => np.s ! ResEng.Nom; lock_Cl = <>};

prefix_N n = compoundN (UttNP (DetCN (DetSg MassDet NoOrd) (UseN n))).s;

----------------------------------------------------------------------
-- verb phrases, actions

VPing  vp = case vp.clform of {HasDone => vp; IsDoing => ProgrVP vp};
vp2Utt vp = mkUtt (ResEng.infVP True vp (ResEng.agrP3 Sg));
-- vp2Utt vp   = mkUtt (vp.s2 ! (ResEng.agrP3 Sg));i_want_to_Str ++


----------------------------------------------------------------------
-- general syntactical operations

disjunct_QCl q q' = 
    {s = \\t,a,p,x => q.s!t!a!p!x ++ "or" ++ q'.s!t!a!p!x;
     lock_QCl = <>};

negate_Cl c = 
    {s = \\t,a,p,o => c.s!t!a!(case p of {ResEng.CNeg _ => ResEng.CPos; ResEng.CPos => ResEng.CNeg Prelude.True})!o;
     lock_Cl = <>};

----------------------------------------------------------------------
-- verbs

see_V           = Irreg.see_V;

do_V2           = Lex.do_V2;
have_V2         = Lex.have_V2;
understand_V2   = Lex.understand_V2;

know_VQ         = mkVQ Irreg.know_V;
wonder_VQ       = Lex.wonder_VQ;

say_VS          = Lex.say_VS;

fail_VV         = mkVV (regV "fail");
like_VV         = mkVV (regV "like");

----------------------------------------------------------------------
-- nouns, proper nouns, common nouns and noun phrases

information_N   = regN "information";

you_NP          = UsePron Lex.youSg_Pron;

----------------------------------------------------------------------
-- closed word categories

of_på_Prep      = mkPrep "of";
for_Prep        = mkPrep "for";

not_Predet      = ss "not" ** {lock_Predet = <>};

no_Quant        = {s = \\_ => "no"; lock_Quant = <>};
all_Quant       = {s = "all"; lock_QuantPl = <>};


------------------------------------------------------------------

i_dont_want_to = variants { ["i do not want to"];
                            ["i don't want to"] };

}