From ea6cb208cbcb605ebf03ed491398bd19872061bf Mon Sep 17 00:00:00 2001 From: janna Date: Wed, 28 Jan 2004 08:51:28 +0000 Subject: [PATCH] *** empty log message *** --- grammars/health/Health.gf | 41 ++++++++++++++++------ grammars/health/HealthEng.gf | 30 ++++++++++++---- grammars/health/HealthFre.gf | 49 +++++++++++++++++---------- grammars/health/HealthRus.gf | 30 +++++++++++----- grammars/health/HealthSwe.gf | 47 +++++++++++++++---------- lib/resource-0.6/russian/MorphoRus.gf | 12 +++++++ src/JavaGUI/GFEditor2.java | 11 ++++-- 7 files changed, 155 insertions(+), 65 deletions(-) diff --git a/grammars/health/Health.gf b/grammars/health/Health.gf index db901d29f..e477db905 100644 --- a/grammars/health/Health.gf +++ b/grammars/health/Health.gf @@ -1,17 +1,15 @@ abstract Health = { cat - Specialization ; Patient ; Body ; Symptom ; SymptomDegree ; Illness ; + Specialization ; Patient ; BodyPart ; Symptom ; SymptomDegree ; Illness ; Prop ; Condition ; Medicine ; fun And : Prop -> Prop -> Prop ; Complain : Patient -> Symptom -> Prop ; - FeverMod : SymptomDegree -> Symptom ; - PainIn : Patient -> Body -> Prop ; - PainInMod : Patient -> Body -> SymptomDegree -> Prop ; - Injured : Patient -> Body -> Prop ; - Broken : Patient -> Body -> Prop ; + PainIn : Patient -> BodyPart -> Prop ; + Injured : Patient -> BodyPart -> Prop ; + Broken : Patient -> BodyPart -> Prop ; HaveIllness : Patient -> Illness -> Prop ; BeInCondition : Patient -> Condition -> Prop ; NeedDoctor : Patient -> Specialization -> Prop ; @@ -19,18 +17,39 @@ fun TakeMedicine : Patient -> Medicine -> Prop ; CatchCold : Condition ; Pregnant : Condition ; - Fever : Symptom ; - High : SymptomDegree ; - Terrible : SymptomDegree ; - Head : Body ; - Leg : Body ; + ShePatient : Patient ; TheyPatient : Patient ; IPatientHe : Patient ; + Influenza : Illness ; Malaria : Illness ; Dentist : Specialization ; + PainKiller : Medicine ; + Head : BodyPart ; + Leg : BodyPart ; + Stomac : BodyPart ; + Throat : BodyPart ; + Ear : BodyPart ; + Chest : BodyPart ; + Foot : BodyPart ; + Arm : BodyPart ; + Back : BodyPart ; + Shoulder : BodyPart ; +-- Knee : BodyPart ; +-- Tooth : BodyPart ; + + Fever : Symptom ; + +-- PainInMod : Patient -> BodyPart -> SymptomDegree -> Prop ; +-- SymptomMod : SymptomDegree -> Symptom -> Symtom; +-- High : SymptomDegree ; +-- Low : SymptomDegree ; +-- Terrible : SymptomDegree ; +-- BloodPressure : Symptom ; + + } ; diff --git a/grammars/health/HealthEng.gf b/grammars/health/HealthEng.gf index 5663f38cd..ea33f11d6 100644 --- a/grammars/health/HealthEng.gf +++ b/grammars/health/HealthEng.gf @@ -9,7 +9,7 @@ lincat Patient = NP ; -- CN is not enough, because of the different form of the "head" body part -- expression in "I have a headache" and "I have injured my head": - Body = BodyCNCategory ; + BodyPart = BodyCNCategory ; Symptom = NP ; SymptomDegree = AP ; Prop = S ; @@ -30,22 +30,34 @@ lin Dentist = cnHum (nounReg "dentist")** {lock_CN = <>} ; PainKiller = cnNoHum (nounReg "painkiller")** {lock_CN = <>} ; - High = AdjP1 ((regAdjective "high") ** {lock_Adj1 = <>}); - Terrible = AdjP1 ((regAdjective "terrible")** {lock_Adj1 = <>}); - Leg = { s = \\_,n,_ => case n of {Sg =>"leg" ; Pl=> "legs" }; painInType = True } ; Head = { s = table{ True => table {Sg => table {_ => "head" }; Pl => table {_ => "heads" }}; False => table { _ => table {_=> "headache"}}} ; painInType = False } ; + Stomac = { s = table{ True => table {Sg => table {_ => "stomach" }; + Pl => table {_ => "stomachs" }}; + False => table { _ => table {_=> "stomach-ache"}}} ; + painInType = False } ; +-- Tooth = { s = table{ True => table {Sg => table {_ => "tooth" }; +-- Pl => table {_ => "teeth" }}; +-- False => table { _ => table {_=> "toothache"}}} ; +-- painInType = False } ; + Throat = { s = \\_,n,_ => case n of {Sg =>"throat" ; Pl=> "throats" }; painInType = True } ; + Ear = { s = \\_,n,_ => case n of {Sg =>"ear" ; Pl=> "ears" }; painInType = True } ; + Chest = { s = \\_,n,_ => case n of {Sg =>"chest" ; Pl=> "chests" }; painInType = True } ; + Foot = { s = \\_,n,_ => case n of {Sg =>"foot" ; Pl=> "feet" }; painInType = True } ; + Arm = { s = \\_,n,_ => case n of {Sg =>"arm" ; Pl=> "arms" }; painInType = True } ; + Back = { s = \\_,n,_ => case n of {Sg =>"back" ; Pl=> "backs" }; painInType = True } ; + Shoulder = { s = \\_,n,_ => case n of {Sg =>"shoulder" ; Pl=> "shoulders" }; painInType = True } ; +-- Knee = { s = \\_,n,_ => case n of {Sg =>"knee" ; Pl=> "knees" }; painInType = True } ; BeInCondition = PredVP ; Pregnant = PosVG ( PredAP( AdjP1 (regAdjective ["pregnant"] ** {lock_Adj1 = <>}))) ; CatchCold = PosVG (PredTV (tvHave** {lock_TV = <>}) (DetNP (aDet** {lock_Det = <>}) (cnNoHum (nounReg "cold")** {lock_CN = <>}))); Fever = DetNP (aDet** {lock_Det = <>}) (cnNoHum (nounReg "fever")** {lock_CN = <>}) ; - FeverMod degree = DetNP (aDet** {lock_Det = <>}) (ModAdj degree (cnNoHum (nounReg "fever")** {lock_CN = <>})) ; HaveIllness patient illness = predV2 tvHave patient (DetNP (nullDet** {lock_Det = <>}) illness) ; Complain = predV2 tvHave ; @@ -61,7 +73,13 @@ lin Broken = injuredBody (mkTransVerb verbP3Have "broken"**{lock_TV = <>}) ; PainIn = painInPatientsBody (cnNoHum (nounReg "pain")**{lock_CN = <>}) ; - PainInMod = painInPatientsBodyMode (cnNoHum (nounReg "pain")**{lock_CN = <>}); + +-- PainInMod = painInPatientsBodyMode (cnNoHum (nounReg "pain")**{lock_CN = <>}); +-- SymptomMod degree symptom = DetNP (aDet** {lock_Det = <>}) +-- (ModAdj degree (symptom ** {lock_CN = <>})) ; +-- High = AdjP1 ((regAdjective "high") ** {lock_Adj1 = <>}); +-- Low = AdjP1 ((regAdjective "low") ** {lock_Adj1 = <>}); +-- Terrible = AdjP1 ((regAdjective "terrible")** {lock_Adj1 = <>}); }; diff --git a/grammars/health/HealthFre.gf b/grammars/health/HealthFre.gf index 5d8818108..77cfb6c5d 100644 --- a/grammars/health/HealthFre.gf +++ b/grammars/health/HealthFre.gf @@ -13,7 +13,7 @@ flags lincat Patient = NP ; - Body = CN ; + BodyPart = CN ; Symptom = NP ; SymptomDegree = AP ; Prop = S ; @@ -23,7 +23,7 @@ lincat Medicine = CN ; lin - And x y = ConjS AndConj (TwoS x y) ; + And x y = ConjS AndConj (TwoS x y) ; ShePatient = SheNP ; TheyPatient = TheyNP ; @@ -38,11 +38,6 @@ lin CatchCold = PosVG (PredTV (tvDir vAvoir) (IndefOneNP (mkCNomReg "rhume" Masc ** {lock_CN = <> }))); Pregnant = PosVG (PredAP (mkAdjective (adjJeune "enceinte") adjPost** {lock_AP = <> })) ; - High = AdjP1 (mkAdjReg "lev" adjPost ** {lock_Adj1 = <> }) ; - Terrible = AdjP1 ((mkAdjective (mkAdj "terrible" "terrible" "terrible" "terrible") adjPre ** {lock_Adj1 = <> })** {lock_AP = <> }); - - Head = mkCNomReg "tte" Fem ** {lock_CN = <> }; - Leg = mkCNomReg "jambe" Fem ** {lock_CN = <> }; Dentist = mkCNomReg "dentiste" Masc ** {lock_CN = <> } ; PainKiller = mkCNomReg "calmant" Masc ** {lock_CN = <> }; @@ -51,19 +46,8 @@ lin TakeMedicine patient medicine = predV2 (mkTransVerbDir (verbPres (conj3prendre "prendre")) ** {lock_TV = <> } ) patient (IndefOneNP medicine) ; - FeverMod degree = DetNP (delDet ** {lock_Det = <> }) (ModAdj degree (mkCNomReg "fivre" Fem** {lock_CN = <> })) ; Fever = DetNP (delDet ** {lock_Det = <> }) (mkCNomReg "fivre" Fem ** {lock_CN = <> }) ; - PainInMod patient head degree = predV2 (tvDir vAvoir) patient - (DetNP (nullDet ** {lock_Det = <> }) - ( ModAdj degree - ( - AppFun ((mkCNomReg "mal" Masc ** {lock_CN = <> })** complementCas Dat** {lock_Fun = <> }) - (defNounPhrase patient.n head ** {lock_NP = <> }) - ) - ) - ) ; - PainIn patient head = predV2 (tvDir vAvoir) patient (DetNP (nullDet ** {lock_Det = <> }) ( @@ -76,5 +60,34 @@ lin Injured = injuredBody (adjReg "bless") ; Broken = injuredBody (adjReg "cass") ; + + Head = mkCNomReg "tte" Fem ** {lock_CN = <> }; + Leg = mkCNomReg "jambe" Fem ** {lock_CN = <> }; + Stomac = mkCNomReg "estomac" Masc ** {lock_CN = <> }; + Throat = mkCNomReg "gorge" Fem ** {lock_CN = <> }; + Ear = mkCNomReg "oreille" Fem ** {lock_CN = <> }; + Chest = mkCNomReg "poitrine" Fem ** {lock_CN = <> }; + Foot = mkCNomReg "pied" Masc ** {lock_CN = <> }; + Arm = mkCNomReg "bras" Masc ** {lock_CN = <> }; + Back = mkCNomReg "dos" Masc ** {lock_CN = <> }; + Shoulder = mkCNomReg "epaule" Fem ** {lock_CN = <> }; +-- Knee = mkCNomReg "genou" Masc ** {lock_CN = <> }; +-- Tooth = mkCNomReg "dents" Masc ** {lock_CN = <> }; + + +-- High = AdjP1 (mkAdjReg "lev" adjPost ** {lock_Adj1 = <> }) ; +-- Terrible = AdjP1 ((mkAdjective (mkAdj "terrible" "terrible" "terrible" "terrible") adjPre ** {lock_Adj1 = <> })** {lock_AP = <> }); +-- FeverMod degree = DetNP (delDet ** {lock_Det = <> }) (ModAdj degree (mkCNomReg "fivre" Fem** {lock_CN = <> })) ; +-- PainInMod patient head degree = predV2 (tvDir vAvoir) patient +-- (DetNP (nullDet ** {lock_Det = <> }) +-- ( ModAdj degree +-- ( +-- AppFun ((mkCNomReg "mal" Masc ** {lock_CN = <> })** complementCas Dat** {lock_Fun = <> }) +-- (defNounPhrase patient.n head ** {lock_NP = <> }) +-- ) +-- ) +-- ) ; + + }; diff --git a/grammars/health/HealthRus.gf b/grammars/health/HealthRus.gf index 869d83e31..ddbaf9473 100644 --- a/grammars/health/HealthRus.gf +++ b/grammars/health/HealthRus.gf @@ -9,7 +9,7 @@ flags lincat Patient = NP ; - Body = CN ; + BodyPart = CN ; Symptom = NP ; SymptomDegree = AP ; Prop = S ; @@ -30,13 +30,8 @@ lin Dentist = n2n stomatolog ** {lock_CN = <>}; PainKiller = n2n obezbolivauchee ** {lock_CN = <>}; - High = AdjP1 (extAdjective vusokij ** {lock_Adj1 = <>}); - Terrible = AdjP1 (extAdjective uzhasnuj ** {lock_Adj1 = <>}); - Head = n2n golova ** {lock_CN = <>}; - Leg = n2n noga ** {lock_CN = <>}; Fever = mkNounPhrase Sg (n2n temperatura)** {lock_NP = <>}; - FeverMod degree = mkNounPhrase Sg (ModAdj degree (n2n temperatura** {lock_CN = <>})) ** {lock_NP = <>}; BeInCondition = PredVP ; CatchCold = PosVG (PredAP (AdjP1 (prostuzhen ** {lock_Adj1 = <>}))) ; Pregnant = PosVG (PredAP (AdjP1 (beremenen ** {lock_Adj1 = <>}))) ; @@ -59,8 +54,25 @@ lin PainIn patient head = U_predTransVerb True (mkDirectVerb (extVerb verbBolet_2 Act Present ) ** {lock_TV =<>}) patient (mkNounPhrase patient.n head ** {lock_NP =<>}) ; - PainInMod patient head degree = U_predTransVerb True (mkDirectVerb - (extVerb have Act Present) ** {lock_TV =<>}) patient (mkNounPhrase Sg (ModAdj degree - (AppFun (mkFun bol "в" Prepos ** {lock_Fun = <>}) (mkNounPhrase patient.n head** {lock_NP = <>}))) ** {lock_NP =<>}); + Head = n2n golova ** {lock_CN = <>}; + Leg = n2n noga ** {lock_CN = <>}; + Stomac = n2n zhivot ** {lock_CN = <>}; + Throat = n2n gorlo ** {lock_CN = <>}; + Ear = n2n ukho ** {lock_CN = <>}; + Chest = n2n grud ** {lock_CN = <>}; + Foot = n2n stopa ** {lock_CN = <>}; + Arm = n2n ruka ** {lock_CN = <>}; + Back = n2n spina ** {lock_CN = <>}; + Shoulder = n2n plecho ** {lock_CN = <>}; +-- Knee = n2n koleno ** {lock_CN = <>}; +-- High = AdjP1 (extAdjective vusokij ** {lock_Adj1 = <>}); +-- Terrible = AdjP1 (extAdjective uzhasnuj ** {lock_Adj1 = <>}); +-- FeverMod degree = mkNounPhrase Sg +-- (ModAdj degree (n2n temperatura** {lock_CN = <>})) ** {lock_NP = <>}; +-- PainInMod patient head degree = U_predTransVerb True (mkDirectVerb +-- (extVerb have Act Present) ** {lock_TV =<>}) patient +-- (mkNounPhrase Sg (ModAdj degree +--(AppFun (mkFun bol "в" Prepos ** {lock_Fun = <>}) +-- (mkNounPhrase patient.n head** {lock_NP = <>}))) ** {lock_NP =<>}); }; diff --git a/grammars/health/HealthSwe.gf b/grammars/health/HealthSwe.gf index 3c4b1d1af..32d41ab2a 100644 --- a/grammars/health/HealthSwe.gf +++ b/grammars/health/HealthSwe.gf @@ -8,14 +8,14 @@ -- use this path to read the grammar from the same directory --# -path=.:../newresource/abstract:../prelude:../newresource/swedish -concrete HealthSwe of Health = open PredicationSwe, ResourceSwe, Prelude, SyntaxSwe, ExtraSwe in { +concrete HealthSwe of Health = open PredicationSwe, ResourceSwe, Prelude, SyntaxSwe, ExtraSwe, ParadigmsSwe in { flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; lincat Patient = patientNPCategory ; - Body = CN ; + BodyPart = CN ; Symptom = NP ; SymptomDegree = AP ; Prop = S ; @@ -33,15 +33,12 @@ lin Influenza = n2n (extCommNoun NoMasc (sApa "influens")) ** {lock_CN = <>} ; Malaria = n2n (extCommNoun NoMasc (sApa "malari")) ** {lock_CN = <>} ; - Head = n2n (extCommNoun NoMasc (sHus "huvud")) ** {lock_CN = <>} ; - Leg = n2n (extCommNoun NoMasc (sHus "ben")) ** {lock_CN = <>} ; + Dentist = n2n (extCommNoun Masc (sKikare "tandlkar")) ** {lock_CN = <>} ; PainKiller = n2n (extCommNoun NoMasc (sBil "smrtstillande")) ** {lock_CN = <>} ; CatchCold = PosVG ( PredAP( AdjP1 (extAdjective (aGrund("frkyl")) ** {lock_Adj1 = <>}) )); Pregnant = PosVG ( PredAP( AdjP1 (extAdjective (aGrund("gravi") )** {lock_Adj1 = <>}) )); - High = AdjP1 (extAdjective (aFin "hg")** {lock_Adj1 = <>}) ; - Terrible = AdjP1 (extAdjective (aFin "hemsk")** {lock_Adj1 = <>}) ; BeInCondition = PredVP ; HaveIllness patient illness = predV2 (mkDirectVerb verbHa** {lock_TV =<>}) patient @@ -53,7 +50,6 @@ lin NeedDoctor patient illness = predV2 (mkDirectVerb verbBehova** {lock_TV =<>}) patient (DetNP (enDet ** {lock_Det = <>}) illness) ; Fever = DetNP (nullDet ** {lock_Det = <>}) (n2n (extCommNoun NoMasc (sFeber "feb")) ** {lock_CN = <>}) ; - FeverMod degree = DetNP (nullDet ** {lock_Det = <>}) (ModAdj degree (n2n (extCommNoun NoMasc (sFeber "feb")) ** {lock_CN = <>})) ; Complain = predV2 (mkDirectVerb verbHa ** {lock_TV =<>}) ; Broken patient head = predV2 (mkTransVerb verbHa "brutit" ** {lock_TV =<>} ) patient @@ -63,20 +59,35 @@ lin ( DetNP (nullDet ** {lock_Det = <>}) ( AppFun - ((mkFun (extCommNoun NoMasc (sBil "ont")) "i") ** {lock_Fun = <>}) + ((mkFun (extCommNoun NoMasc (sBil "ont")**{lock_N =<>}) "i") ** {lock_Fun = <>}) ((defNounPhrase patient.n head)** {lock_NP = <>}) ) ) ; - PainInMod patient head degree = predV2 (mkDirectVerb verbHa** {lock_TV =<>}) patient - ( - DetNP (nullDet ** {lock_Det = <>}) - ( modCommNounPhrase degree - ( AppFun - ((mkFun (extCommNoun NoMasc (sBil "ont")) "i") ** {lock_Fun = <>}) - ((defNounPhrase patient.n head)** {lock_NP = <>}) - ) ** {lock_CN = <>} - ) - ) ; + + Head = n2n (extCommNoun NoMasc(sHus "huvud")) ** {lock_CN = <>} ; + Leg = n2n (extCommNoun NoMasc (sHus "ben")) ** {lock_CN = <>} ; + Stomac = n2n (nPojke "mage") ** {lock_CN = <>} ; + Throat = n2n (nBil "hals") ** {lock_CN = <>} ; + Ear = n2n (mkN "ra" "rat" "ron" "ronen" Neutr NoMasc) ** {lock_CN = <>} ; + Chest = n2n (extCommNoun NoMasc (sHus "brst")) ** {lock_CN = <>} ; + Foot = n2n (mkN "fot" "foten" "ftter" "ftterna" Utr NoMasc) ** {lock_CN = <>} ; + Arm = n2n (mkN "hand" "handen" "hnder" "hnderna" Utr NoMasc) ** {lock_CN = <>} ; + Back = n2n (nBil "rygg") ** {lock_CN = <>} ; + Shoulder = n2n (nNyckel "axel") ** {lock_CN = <>} ; + +-- High = AdjP1 (extAdjective (aFin "hg")** {lock_Adj1 = <>}) ; +-- Terrible = AdjP1 (extAdjective (aFin "hemsk")** {lock_Adj1 = <>}) ; +-- FeverMod degree = DetNP (nullDet ** {lock_Det = <>}) (ModAdj degree (n2n (extCommNoun NoMasc (sFeber "feb")) ** {lock_CN = <>})) ; +-- PainInMod patient head degree = predV2 (mkDirectVerb verbHa** {lock_TV =<>}) patient +-- ( +-- DetNP (nullDet ** {lock_Det = <>}) +-- ( modCommNounPhrase degree +-- ( AppFun +-- ((mkFun (extCommNoun NoMasc (sBil "ont")) "i") ** {lock_Fun = <>}) +-- ((defNounPhrase patient.n head)** {lock_NP = <>}) +-- ) ** {lock_CN = <>} +-- ) +-- ) ; Injured = injuredBody ; diff --git a/lib/resource-0.6/russian/MorphoRus.gf b/lib/resource-0.6/russian/MorphoRus.gf index d631eeffd..6e1a8121a 100644 --- a/lib/resource-0.6/russian/MorphoRus.gf +++ b/lib/resource-0.6/russian/MorphoRus.gf @@ -332,6 +332,18 @@ oper pronVseInanimate: Pronoun = oper SubstFormDecl = SS1 SubstForm ; +oper gorlo : CommNoun = oEndInAnimateDecl "горл" ; +oper koleno : CommNoun = oEndInAnimateDecl "колен" ; +oper plecho : CommNoun = oEndInAnimateDecl "плеч" ; +oper ukho : CommNoun = oEndInAnimateDecl "ух" ; +oper zhivot : CommNoun = nullEndInAnimateDecl1 "живот" ; +oper grud : CommNoun = softSignEndDeclFem "груд" ; +oper spina : CommNoun = aEndG_K_KH_Decl "спин" ; +oper stopa : CommNoun = aEndG_K_KH_Decl "стоп" ; +oper ruka : CommNoun = aEndG_K_KH_Decl "рук" ; + + + oper muzhchina : CommNoun = (aEndAnimateDecl "мужчин") ** { g = Masc ; anim = Animate } ; oper zhenchina : CommNoun = (aEndAnimateDecl "женщин") ** { g = Fem ; anim = Animate } ; oper mama : CommNoun = (aEndAnimateDecl "мам")**{ g = Fem ; anim = Animate } ; diff --git a/src/JavaGUI/GFEditor2.java b/src/JavaGUI/GFEditor2.java index f8c1e1fd1..0acd1fdf2 100644 --- a/src/JavaGUI/GFEditor2.java +++ b/src/JavaGUI/GFEditor2.java @@ -31,7 +31,7 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, public static String selectedText=""; public static boolean debug = false; - public static boolean debug3 = true; + public static boolean debug3 = false; public static boolean debug2 = false; public static boolean selectionCheck = false; public static String focusPosition = ""; @@ -563,8 +563,13 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, Locale.setDefault(Locale.US); try { Process extProc = Runtime.getRuntime().exec(args[0]); - fromProc = new BufferedReader (new InputStreamReader( - extProc.getInputStream(),"UTF8")); + InputStreamReader isr = new InputStreamReader( + extProc.getInputStream(),"UTF8"); + // extProc.getInputStream()); + + fromProc = new BufferedReader (isr); +String defaultEncoding = isr.getEncoding(); +System.out.println("encoding "+defaultEncoding); toProc = new BufferedWriter(new OutputStreamWriter(extProc.getOutputStream(),"UTF8")); /* try { UIManager.setLookAndFeel(