summaryrefslogtreecommitdiff
path: root/examples/disamb/ConversationIta.gf
blob: 6728a38b09569f3dbfca92555d0a45bc00daf3fc (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
--# -path=.:prelude

concrete ConversationIta of Conversation = open Prelude in {

  lincat 
    Q = {s : Str} ;
    NP = {s : Str ; g : Gen ; n : Num ; p : Pol} ;
    A  = {s : Gen => Num => Str} ;
    Gender = {s : Str ; g : Gen} ;
    Number = {s : Str ; n : Num} ;
    Politeness = {s : Str ; p : Pol} ;

  param
    Num = Sg | Pl ;
    Gen = Masc | Fem ;
    Pol = Fam | Resp ;
  lin
    PredA np a = ss (np.s ++ essere np.n np.p ++ a.s ! np.g ! np.n) ;

    GMasc = ss [] ** {g = Masc} ;
    GFem  = ss [] ** {g = Fem} ; 
    NSg   = ss [] ** {n = Sg} ; 
    NPl   = ss [] ** {n = Pl} ;
    PFamiliar = ss [] ** {p = Fam} ;
    PPolite   = ss [] ** {p = Resp} ;

    You n p g = 
      {g = g.g ; n = n.n ; p = p.p ;
        s = case <n.n, p.p> of {
          <Sg,Fam> => "tu" ; 
          <Sg,Resp> => "Lei" ; 
          <Pl,Fam> => "voi" ; 
          <Pl,Resp> => "Loro"
          } ++ g.s ++ p.s ++ n.s
      } ; 

    Ready = regA "pronto" ;

  oper
    essere : Num -> Pol -> Str = \n,p -> case <n,p> of {
      <Sg,Fam> => "sei" ;
      <Sg,Resp> => "è" ; 
      <Pl,Fam> => "siete" ; 
      <Pl,Resp> => "sono"
      } ;

    regA : Str -> {s : Gen => Num => Str} = \nero ->
      let ner = init nero in {
        s = \\g,n => case <n,g> of {
         <Sg,Fem> => ner + "a" ;
         <Sg,Masc> => nero ; 
         <Pl,Fem> => ner + "e" ; 
         <Pl,Mas> => ner + "i"
         }
      } ;

}