From 2e935bf2c0dd5271a6d40b259cb4c15db44cd121 Mon Sep 17 00:00:00 2001 From: aarne Date: Sun, 13 Mar 2011 17:22:51 +0000 Subject: [PATCH] some more transfer functions included in Grammar --- lib/src/abstract/Grammar.gf | 5 +++-- lib/src/abstract/Lang.gf | 2 +- lib/src/abstract/Sentence.gf | 2 +- lib/src/abstract/Transfer.gf | 29 +++++++++++++++++++++++++++++ lib/src/abstract/Verb.gf | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 lib/src/abstract/Transfer.gf diff --git a/lib/src/abstract/Grammar.gf b/lib/src/abstract/Grammar.gf index d19ed6869..25ded6029 100644 --- a/lib/src/abstract/Grammar.gf +++ b/lib/src/abstract/Grammar.gf @@ -10,7 +10,6 @@ abstract Grammar = Adjective, Adverb, Numeral, - NumeralTransfer, Sentence, Question, Relative, @@ -19,5 +18,7 @@ abstract Grammar = Text, Structural, Idiom, - Tense ; + Tense, + Transfer + ; diff --git a/lib/src/abstract/Lang.gf b/lib/src/abstract/Lang.gf index 978d970ad..88df386b0 100644 --- a/lib/src/abstract/Lang.gf +++ b/lib/src/abstract/Lang.gf @@ -6,7 +6,7 @@ -- which may be more suitable to open in applications. abstract Lang = - Grammar, + Grammar, Lexicon ** { flags startcat=Phr ; diff --git a/lib/src/abstract/Sentence.gf b/lib/src/abstract/Sentence.gf index bda7b7302..12283d70b 100644 --- a/lib/src/abstract/Sentence.gf +++ b/lib/src/abstract/Sentence.gf @@ -9,7 +9,7 @@ abstract Sentence = Cat ** { -- Clauses are converted to $S$ (with fixed tense) with the -- $UseCl$ function below. - fun + data PredVP : NP -> VP -> Cl ; -- John walks -- Using an embedded sentence as a subject is treated separately. diff --git a/lib/src/abstract/Transfer.gf b/lib/src/abstract/Transfer.gf new file mode 100644 index 000000000..8a0c5512f --- /dev/null +++ b/lib/src/abstract/Transfer.gf @@ -0,0 +1,29 @@ +abstract Transfer = Sentence, Verb, Adverb, Structural, NumeralTransfer ** { + +{- +-- examples of transfer: to test, + + > i LangEng.gf + + > p "she sees him" | pt -transfer=active2passive | l + he is seen by her + + > p "wouldn't she see him" | pt -transfer=active2passive | l + wouldn't he be seen by her + + > p -cat=NP "3 cats with 4 dogs" | pt -transfer=digits2numeral | l + three cats with four dogs +-} + +fun + active2passive : Cl -> Cl ; +def + active2passive (PredVP subj (ComplSlash (SlashV2a v) obj)) = + PredVP obj (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) ; + active2passive (PredVP subj (AdvVP (ComplSlash (SlashV2a v) obj) adv)) = + PredVP obj (AdvVP (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj)) adv) ; + active2passive (PredVP subj (AdVVP adv (ComplSlash (SlashV2a v) obj))) = + PredVP obj (AdVVP adv (AdvVP (PassV2 v) (PrepNP by8agent_Prep subj))) ; + active2passive cl = cl ; + +} diff --git a/lib/src/abstract/Verb.gf b/lib/src/abstract/Verb.gf index 906305d4f..68efc49cc 100644 --- a/lib/src/abstract/Verb.gf +++ b/lib/src/abstract/Verb.gf @@ -7,7 +7,7 @@ abstract Verb = Cat ** { -- Verb phrases are constructed from verbs by providing their -- complements. There is one rule for each verb category. - fun + data UseV : V -> VP ; -- sleep ComplVV : VV -> VP -> VP ; -- want to run