multimodal resource recreated for new API

This commit is contained in:
aarne
2005-12-05 18:31:15 +00:00
parent 936e402373
commit 7a7252223f
10 changed files with 271 additions and 8 deletions

View File

@@ -0,0 +1,80 @@
resource DemRes = open Prelude in {
oper
Point : Type =
{point : Str} ;
point : Point -> Str = \p ->
p.point ;
mkPoint : Str -> Point = \s ->
{point = s} ;
noPoint : Point =
mkPoint [] ;
concatPoint : (x,y : Point) -> Point = \x,y ->
mkPoint (point x ++ point y) ;
-- A type is made demonstrative by adding $Point$.
Dem : Type -> Type = \t -> t ** Point ;
mkDem : (t : Type) -> t -> Point -> Dem t = \_,x,s ->
x ** s ;
nonDem : (t : Type) -> t -> Dem t = \t,x ->
mkDem t x noPoint ;
{-
mkDemS : Cl -> DemAdverb -> Pointing -> MultiSentence = \cl,adv,p ->
{s = table {
MInd b => msS (UseCl (polar b) (AdvCl cl adv)) ;
MQuest b => msQS (UseQCl (polar b) (QuestCl (AdvCl cl adv)))
} ;
point = p.point ++ adv.point
} ;
polar : Bool -> TP = \b -> case b of {
True => PosTP TPresent ASimul ;
False => NegTP TPresent ASimul
} ;
mkDemQ : QCl -> DemAdverb -> Pointing -> MultiQuestion = \cl,adv,p ->
{s = \\b => msQS (UseQCl (polar b) cl) ++ adv.s ; --- (AdvQCl cl adv)) ;
point = p.s5 ++ adv.s5
} ;
mkDemImp : VCl -> DemAdverb -> Pointing -> MultiImperative = \cl,adv,p ->
{s = table {
True => msImp (PosImpVP cl) ++ adv.s ;
False => msImp (NegImpVP cl) ++ adv.s
} ;
s5 = p.s5 ++ adv.s5
} ;
msS : S -> Str ;
msQS : QS -> Str ;
msImp : Imp -> Str ;
concatDem : (x,y : Pointing) -> Pointing = \x,y -> {
s5 = x.s5 ++ y.s5
} ;
MultiSentence : Type = mkDemType {s : MSForm => Str} ;
MultiQuestion : Type = mkDemType {s : Bool => Str} ;
MultiImperative : Type = mkDemType {s : Bool => Str} ;
Demonstrative : Type = mkDemType NP ;
DemAdverb : Type = mkDemType Adv ;
mkDAdv : Adv -> Pointing -> DemAdverb = \a,p ->
a ** p ** {lock_Adv = a.lock_Adv} ;
param
MSForm = MInd Bool | MQuest Bool ;
-}
}

View File

@@ -0,0 +1,70 @@
abstract Demonstrative = Cat, Tense ** {
cat
MS ; -- multimodal sentence or question
MQS ; -- multimodal wh question
MImp ; -- multimodal imperative
MVP ; -- multimodal verb phrase
DNP ; -- demonstrative noun phrase
DAdv ; -- demonstrative adverbial
Point ; -- pointing gesture
fun
-- A pointing gesture is constructed from a string.
MkPoint : String -> Point ;
-- Construction of sentences, questions, and imperatives.
PredMVP : DNP -> MVP -> MS ; -- he flies here
QuestMVP : DNP -> MVP -> MQS ; -- does he fly here
QQuestMVP : IP -> MVP -> MQS ; -- who flies here
ImpMVP : MVP -> MImp ; -- fly here!
-- Construction of verb phrases from verb + complements.
DemV : V -> MVP ; -- flies (here)
DemV2 : V2 -> DNP -> MVP ; -- takes this (here)
DemVV : VV -> MVP -> MVP ; -- wants to fly (here)
-- Adverbial modification of a verb phrase.
AdvMVP : MVP -> DAdv -> MVP ;
-- Demonstrative pronouns as NPs and determiners.
this_DNP : Point -> DNP ; -- this
that_DNP : Point -> DNP ; -- that
thisDet_DNP : Point -> CN -> DNP ; -- this car
thatDet_DNP : Point -> CN -> DNP ; -- that car
-- Demonstrative adverbs.
here_DAdv : Point -> DAdv ; -- here
here7from_DAdv : Point -> DAdv ; -- from here
here7to_DAdv : Point -> DAdv ; -- to here
-- Building an adverb as prepositional phrase.
PrepDNP : Prep -> DNP -> DAdv ;
-- Using ordinary categories.
-- Interface to $Demonstrative$.
DemNP : NP -> DNP ;
DemAdv : Adv -> DAdv ;
PhrMS : Pol -> MS -> Phr ;
PhrMS : Pol -> MS -> Phr ;
PhrMQS : Pol -> MQS -> Phr ;
PhrMImp : Pol -> MImp -> Phr ;
-- For testing and example-based grammar writing.
point1, point2 : Point ;
}

View File

@@ -0,0 +1,6 @@
--# -path=.:../english/:../abstract:../common:prelude
concrete DemonstrativeEng of Demonstrative = CatEng, TenseX ** DemonstrativeI with
(Test = TestEng),
(Structural = StructuralEng) ;

View File

@@ -0,0 +1,53 @@
incomplete concrete DemonstrativeI of Demonstrative = Cat, TenseX **
open Prelude, Test, Structural, ParamX, DemRes in {
lincat
MS = Dem {s : Polarity => Str} ;
MQS = Dem {s : Polarity => Str} ;
MImp = Dem {s : Polarity => Str} ;
MVP = Dem VP ;
DNP = Dem NP ;
DAdv = Dem Adv ;
Point = DemRes.Point ;
lin
MkPoint s = mkPoint s.s ;
PredMVP np vp =
let cl = PredVP np vp
in
mkDem
{s : Polarity => Str}
(polCases (PosCl cl).s (NegCl cl).s) (concatPoint np vp) ;
DemV verb = mkDem VP (UseV verb) noPoint ;
DemV2 verb obj = mkDem VP (ComplV2 verb obj) obj ;
DemVV vv vp = mkDem VP (ComplVV vv vp) vp ;
AdvMVP vp adv =
mkDem VP (AdvVP vp adv) (concatPoint vp adv) ;
this_DNP = mkDem NP this_NP ;
that_DNP = mkDem NP that_NP ;
-- thisDet_DNP p cn = mkDem (DetNP this_Det cn) p ;
-- thatDet_DNP p cn = mkDem (DetNP that_Det cn) p ;
here_DAdv = mkDem Adv here_Adv ;
-- here7from_DAdv = mkDem here7from_Adv ;
-- here7to_DAdv = mkDem here7to_Adv ;
PrepDNP p np = mkDem Adv (PrepNP p np) np ;
DemNP np = nonDem NP (np ** {lock_NP = <>}) ;
-- DemAdv = nonDem Adv ;
PhrMS pol ms = {s = pol.s ++ ms.s ! pol.p ++ ";" ++ ms.point} ;
point1 = mkPoint "p1" ;
point2 = mkPoint "p2" ;
}

View File

@@ -0,0 +1,16 @@
abstract Multimodal =
Noun,
-- Verb,
Adjective,
Adverb,
Numeral,
-- Sentence,
-- Question,
-- Relative,
-- Conjunction,
-- Phrase,
-- Tensed,
Structural,
Demonstrative,
Basic
** {} ;

View File

@@ -0,0 +1,19 @@
--# -path=.:../english/:../abstract:../common:prelude
concrete MultimodalEng of Multimodal =
NounEng,
-- Verb,
AdjectiveEng,
AdverbEng,
NumeralEng,
-- Sentence,
-- Question,
-- Relative,
-- Conjunction,
-- Phrase,
-- Tensed,
StructuralEng,
DemonstrativeEng,
BasicEng
** {} ;