mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
some more transfer functions included in Grammar
This commit is contained in:
@@ -10,7 +10,6 @@ abstract Grammar =
|
|||||||
Adjective,
|
Adjective,
|
||||||
Adverb,
|
Adverb,
|
||||||
Numeral,
|
Numeral,
|
||||||
NumeralTransfer,
|
|
||||||
Sentence,
|
Sentence,
|
||||||
Question,
|
Question,
|
||||||
Relative,
|
Relative,
|
||||||
@@ -19,5 +18,7 @@ abstract Grammar =
|
|||||||
Text,
|
Text,
|
||||||
Structural,
|
Structural,
|
||||||
Idiom,
|
Idiom,
|
||||||
Tense ;
|
Tense,
|
||||||
|
Transfer
|
||||||
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ abstract Sentence = Cat ** {
|
|||||||
-- Clauses are converted to $S$ (with fixed tense) with the
|
-- Clauses are converted to $S$ (with fixed tense) with the
|
||||||
-- $UseCl$ function below.
|
-- $UseCl$ function below.
|
||||||
|
|
||||||
fun
|
data
|
||||||
PredVP : NP -> VP -> Cl ; -- John walks
|
PredVP : NP -> VP -> Cl ; -- John walks
|
||||||
|
|
||||||
-- Using an embedded sentence as a subject is treated separately.
|
-- Using an embedded sentence as a subject is treated separately.
|
||||||
|
|||||||
29
lib/src/abstract/Transfer.gf
Normal file
29
lib/src/abstract/Transfer.gf
Normal file
@@ -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 ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ abstract Verb = Cat ** {
|
|||||||
-- Verb phrases are constructed from verbs by providing their
|
-- Verb phrases are constructed from verbs by providing their
|
||||||
-- complements. There is one rule for each verb category.
|
-- complements. There is one rule for each verb category.
|
||||||
|
|
||||||
fun
|
data
|
||||||
UseV : V -> VP ; -- sleep
|
UseV : V -> VP ; -- sleep
|
||||||
|
|
||||||
ComplVV : VV -> VP -> VP ; -- want to run
|
ComplVV : VV -> VP -> VP ; -- want to run
|
||||||
|
|||||||
Reference in New Issue
Block a user