summaryrefslogtreecommitdiff
path: root/examples/dialogue/DialogueI.gf
blob: 20da618ac16a6a34a26f5f604b6132341df046d5 (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
incomplete concrete DialogueI of Dialogue = open Lang, Prelude in {

  lincat
    Move   = Phr ;
    Action = {s : ActType => Str} ;
    Proposition = Phr ; ----
    Question = Phr ;
    Kind   = CN ;
    Object = NP ;
    Oper0  = V ;
    Oper1  = V2 ;
    Oper2  = V3 ;

  lin
    MRequest a = ss (a.s ! ARequest) ;
    MConfirm a = ss (a.s ! AConfirm) ;
    MAnswer  a = a ;
    MIssue   a = a ;

    MYes = yes_Phr ;
    MNo  = no_Phr ;
    MObject _ ob = PhrUtt NoPConj (UttNP ob) optPlease ;

    PAction a  = ss (a.s ! AConfirm) ;

    QKind k = 
      PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos 
        (ExistIP (IDetCN whichPl_IDet NoNum NoOrd k)))) NoVoc ;

    AOper0 op         = mkAction (UseV op) ;
    AOper1 _   op x   = mkAction (ComplV2 op x) ;
    AOper2 _ _ op x y = mkAction (ComplV3 op x y) ;

    OAll k   = PredetNP all_Predet (DetCN (DetPl (PlQuant IndefArt) NoNum NoOrd) k) ;
    OIndef k = DetCN (DetSg (SgQuant IndefArt) NoOrd) k ;
    ODef k   = DetCN (DetSg (SgQuant DefArt) NoOrd) k ;

  param
    ActType  = ARequest | AConfirm ; -- and some others

  oper

  -- this should perhaps be language dependent - but at least these
  -- variants seem to make sense in all languages

    mkAction : VP -> {s : ActType => Str} = \vp -> {
      s = table {
        ARequest => variants {
          aImp vp ;
          aWant vp ;
          aCanYou vp
          } ;
        AConfirm => variants {
          aInf vp
          }
        }
      } ;

   optPlease : Voc = variants {NoVoc ; please_Voc} ;

   aImp : VP -> Str = \vp ->
     (PhrUtt NoPConj (UttImpSg PPos (ImpVP vp)) optPlease).s ;

   aWant : VP -> Str = \vp ->
     (PhrUtt NoPConj (UttS (UseCl TPres ASimul PPos (PredVP (UsePron i_Pron) 
        (ComplVV want_VV vp)))) optPlease).s ;

   aCanYou : VP -> Str = \vp ->
     (PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos (QuestCl (PredVP 
        (UsePron youSg_Pron) (ComplVV can_VV vp))))) optPlease).s ;

   aInf : VP -> Str = \vp ->
     (PhrUtt NoPConj (UttVP vp) NoVoc).s ;

}