summaryrefslogtreecommitdiff
path: root/grammars/health/ExtraEng.gf
blob: b0057c7c1f4cbdca5274a82788d2dae8d483b727 (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
-- use this path to read the grammar from the same directory
--# -path=.:../abstract:../../prelude:../english

--1 Functions that are not in the API, but common in Russian 
--
-- Aarne Ranta, Janna Khegai 2003

resource ExtraEng = open PredicationEng, ResourceEng, Prelude, SyntaxEng in {

oper 
  BodyCNCategory : Type =   
     { s : Bool => Number => Case => Str ; painInType : Bool} ;

  mkPain: BodyCNCategory -> CN = \body ->
     cnNoHum({ s = \\_,_ => body.s ! body.painInType ! Sg ! Nom  })** {lock_CN = <>} ;       

  mkBody: BodyCNCategory -> CN = \body ->
     cnNoHum({ s = \\n,_ => body.s ! True ! n ! Nom })** {lock_CN = <>} ;       

  injuredBody: TV -> NP -> BodyCNCategory -> S = 
    \haveInjured, patient, head -> 
    predV2 haveInjured patient (hisHead patient (mkBody head) **{lock_NP = <>}) ;

  nullDet : Det = mkDeterminer Sg [] ** {lock_Det = <>};

  hisHead: NP -> CN -> NP =\patient, head ->
    { s =\\c => patient.s ! GenP ++ head.s ! patient.n ! Nom ; 
      n = patient.n ; p = P3 ; lock_NP = <>} ;

  tvHave: TV = mkTransVerbDir verbP3Have ** {lock_TV = <>};


  painInPatientsBody: CN -> NP -> BodyCNCategory -> S = 
    \pain, patient, head -> case head.painInType of { 
      False => predV2 tvHave patient (DetNP (aDet** {lock_Det = <>}) ( mkPain head));
      True => predV2 tvHave patient (DetNP nullDet 
       (
        cnNoHum(appFunComm (pain ** {s2 = "in"}) 
        (hisHead patient (mkBody head)))** {lock_CN = <>}
       )
      )   
   } ;

  painInPatientsBodyMode: CN -> NP -> BodyCNCategory -> AP -> S = 
   \pain, patient, head, degree -> case head.painInType of { 
     False => predV2 tvHave patient (DetNP (aDet** {lock_Det = <>}) 
        (
           modCommNounPhrase degree (mkPain head) ** {lock_CN = <>}
        ));
     True =>  predV2 tvHave patient (DetNP nullDet 
        (
          modCommNounPhrase degree 
          (
             cnNoHum 
            (
              appFunComm (pain ** {s2 = "in"}) 
              (hisHead patient (mkBody head))
            )
          ) ** {lock_CN = <>}
       ))
   } ;

};