updated dialogue to multimodal ; bug fixes in grammar compilation

This commit is contained in:
aarne
2006-05-24 15:40:15 +00:00
parent 750ef2ca30
commit 1aa8abb074
8 changed files with 97 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
interface AuxDialogue = open Lang in { interface AuxDialogue = open Multi in {
oper oper
defN : N -> NP = \n -> defN : N -> NP = \n ->
DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN n) ; DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN n) ;
mkMove : Str -> Phr = \s -> {s = variants { mkMove : Str -> Phr = \s -> {s = variants {

View File

@@ -1,2 +1,2 @@
instance AuxEng of AuxDialogue = open LangEng in { instance AuxEng of AuxDialogue = open MultiEng in {
} }

View File

@@ -14,14 +14,14 @@ abstract Dialogue = {
Oper2 Kind Kind ; Oper2 Kind Kind ;
fun fun
MRequest : Action -> Move ; IRequest : Action -> Input ;
MConfirm : Action -> Move ; IConfirm : Action -> Input ;
MAnswer : Proposition -> Move ; IAnswer : Proposition -> Input ;
MIssue : Question -> Move ; IIssue : Question -> Input ;
MYes : Move ; IYes : Input ;
MNo : Move ; INo : Input ;
MObject : (k : Kind) -> Object k -> Move ; IObject : (k : Kind) -> Object k -> Input ;
PAction : Action -> Proposition ; PAction : Action -> Proposition ;
@@ -35,5 +35,18 @@ abstract Dialogue = {
OIndef : (k : Kind) -> Object k ; OIndef : (k : Kind) -> Object k ;
ODef : (k : Kind) -> Object k ; ODef : (k : Kind) -> Object k ;
-- multimodality
cat
Click ;
Input ; -- multimodal asynchronous input
Speech ; -- speech only
fun
OThis : (k : Kind) -> Click -> Object k ;
OThisKind : (k : Kind) -> Click -> Object k ;
MInput : Input -> Move ;
SInput : Input -> Speech ;
MkClick : String -> Click ;
} }

View File

@@ -1,4 +1,4 @@
--# -path=.:present:prelude --# -path=.:multimodal:alltenses:prelude
concrete DialogueEng of Dialogue = DialogueI with concrete DialogueEng of Dialogue = DialogueI with
(Lang = LangEng) ; (Multi = MultiEng) ;

View File

@@ -1,10 +1,10 @@
incomplete concrete DialogueI of Dialogue = open Lang, Prelude in { incomplete concrete DialogueI of Dialogue = open Multi, Prelude in {
lincat lincat
Move = Phr ; Move = Phr ;
Action = {s : ActType => Str} ; Action = {s : ActType => Str ; point : Str} ;
Proposition = Phr ; ---- Proposition = Utt ; ----
Question = Phr ; Question = Utt ;
Kind = CN ; Kind = CN ;
Object = NP ; Object = NP ;
Oper0 = V ; Oper0 = V ;
@@ -12,26 +12,26 @@ incomplete concrete DialogueI of Dialogue = open Lang, Prelude in {
Oper2 = V3 ; Oper2 = V3 ;
lin lin
MRequest a = ss (a.s ! ARequest) ; IRequest a = {s = a.s ! ARequest ; point = a.point} ;
MConfirm a = ss (a.s ! AConfirm) ; IConfirm a = {s = a.s ! AConfirm ; point = a.point} ;
MAnswer a = a ; IAnswer a = a ;
MIssue a = a ; IIssue a = a ;
MYes = yes_Phr ; IYes = yes_Phr ** noPoint ;
MNo = no_Phr ; INo = no_Phr ** noPoint ;
MObject _ ob = PhrUtt NoPConj (UttNP ob) optPlease ; IObject _ ob = UttNP ob ;
PAction a = ss (a.s ! AConfirm) ; PAction a = {s = a.s ! AConfirm ; point = a.point} ;
QKind k = QKind k =
PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos UttQS (UseQCl TPres ASimul PPos
(ExistIP (IDetCN whichPl_IDet NoNum NoOrd k)))) NoVoc ; (ExistIP (IDetCN whichPl_IDet NoNum NoOrd k))) ;
AOper0 op = mkAction (UseV op) ; AOper0 op = mkAction (UseV op) ;
AOper1 _ op x = mkAction (ComplV2 op x) ; AOper1 _ op x = mkAction (ComplV2 op x) ;
AOper2 _ _ op x y = mkAction (ComplV3 op x y) ; AOper2 _ _ op x y = mkAction (ComplV3 op x y) ;
OAll k = PredetNP all_Predet (DetCN (DetPl (PlQuant IndefArt) NoNum NoOrd) k) ; OAll k = PredetNP all_Predet (DetCN (DetPl (PlQuant IndefArt) NoNum NoOrd) k) ;
OIndef k = DetCN (DetSg (SgQuant IndefArt) NoOrd) k ; OIndef k = DetCN (DetSg (SgQuant IndefArt) NoOrd) k ;
ODef k = DetCN (DetSg (SgQuant DefArt) NoOrd) k ; ODef k = DetCN (DetSg (SgQuant DefArt) NoOrd) k ;
@@ -43,34 +43,54 @@ incomplete concrete DialogueI of Dialogue = open Lang, Prelude in {
-- this should perhaps be language dependent - but at least these -- this should perhaps be language dependent - but at least these
-- variants seem to make sense in all languages -- variants seem to make sense in all languages
mkAction : VP -> {s : ActType => Str} = \vp -> { mkAction : VP -> {s : ActType => Str ; point : Str} = \vp -> {
s = table { s = table {
ARequest => variants { ARequest => (variants {
aImp vp ; aImp vp ;
aWant vp ; aWant vp ;
aCanYou vp aCanYou vp
} ; }).s ;
AConfirm => variants { AConfirm => (variants {
aInf vp aInf vp
} }).s
} } ;
point = vp.point
} ; } ;
optPlease : Voc = variants {NoVoc ; please_Voc} ; optPlease : Voc = variants {NoVoc ; please_Voc} ;
aImp : VP -> Utt = \vp ->
UttImpSg PPos (ImpVP vp) ;
aImp : VP -> Str = \vp -> aWant : VP -> Utt = \vp ->
(PhrUtt NoPConj (UttImpSg PPos (ImpVP vp)) optPlease).s ; UttS (UseCl TPres ASimul PPos
(PredVP (UsePron i_Pron) (ComplVV want_VV vp))) ;
aWant : VP -> Str = \vp -> aCanYou : VP -> Utt = \vp ->
(PhrUtt NoPConj (UttS (UseCl TPres ASimul PPos (PredVP (UsePron i_Pron) UttQS (UseQCl TPres ASimul PPos (QuestCl
(ComplVV want_VV vp)))) optPlease).s ; (PredVP (UsePron youSg_Pron) (ComplVV can_VV vp)))) ;
aCanYou : VP -> Str = \vp -> aInf : VP -> Utt = \vp ->
(PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos (QuestCl (PredVP UttVP vp ;
(UsePron youSg_Pron) (ComplVV can_VV vp))))) optPlease).s ;
aInf : VP -> Str = \vp -> -- multimodality
(PhrUtt NoPConj (UttVP vp) NoVoc).s ;
lincat
Click = Point ;
Input = Utt ;
Speech = Multi.Speech ;
lin
OThis k c = this8point_NP c ;
OThisKind k c = DetCN (DetSg (SgQuant (this8point_Quant c)) NoOrd) k ;
MInput i = PhrUtt NoPConj i optPlease ;
SInput i = SpeechUtt NoPConj i optPlease ;
MkClick = MkPoint ;
oper
noPoint = {point = []} ;
} }

View File

@@ -1,7 +1,7 @@
--# -path=.:present:prelude --# -path=.:multimodal:alltenses:prelude
concrete LightsEng of Lights = concrete LightsEng of Lights =
DialogueEng ** open LangEng, ParadigmsEng, AuxEng, Prelude in { DialogueEng ** open MultiEng, ParadigmsEng, AuxEng, Prelude in {
lin lin
Light = UseN (regN "light") ; Light = UseN (regN "light") ;

View File

@@ -158,6 +158,9 @@ ccompute cnc = comp []
R rs -> maybe (Bad ("unknown label" +++ prt l +++ "in" +++ prt u')) R rs -> maybe (Bad ("unknown label" +++ prt l +++ "in" +++ prt u'))
return $ return $
lookup l [ (x,y) | Ass x y <- rs] lookup l [ (x,y) | Ass x y <- rs]
FV rrs -> do
mapM (\r -> compt (P r l)) rrs >>= return . FV
_ -> return $ P u' l _ -> return $ P u' l
FV ts -> liftM FV (mapM compt ts) FV ts -> liftM FV (mapM compt ts)
C E b -> compt b C E b -> compt b

View File

@@ -72,19 +72,25 @@ lookupResType gr m c = do
CncFun (Just (cat,(cont,val))) _ _ -> do CncFun (Just (cat,(cont,val))) _ _ -> do
val' <- return val ---- lockRecType cat val val' <- return val ---- lockRecType cat val
return $ mkProd (cont, val', []) return $ mkProd (cont, val', [])
CncFun _ _ _ -> do CncFun _ _ _ -> lookFunType m m c
a <- abstractOfConcrete gr m
mu <- lookupModMod gr a
info <- lookupIdentInfo mu c
case info of
AbsFun (Yes ty) _ -> return $ redirectTerm m ty
AbsCat _ _ -> return typeType
_ -> prtBad "cannot find type of reused function" c
AnyInd _ n -> lookupResType gr n c AnyInd _ n -> lookupResType gr n c
ResParam _ -> return $ typePType ResParam _ -> return $ typePType
ResValue (Yes t) -> return $ qualifAnnotPar m t ResValue (Yes t) -> return $ qualifAnnotPar m t
_ -> Bad $ prt c +++ "has no type defined in resource" +++ prt m _ -> Bad $ prt c +++ "has no type defined in resource" +++ prt m
_ -> Bad $ prt m +++ "is not a resource" _ -> Bad $ prt m +++ "is not a resource"
where
lookFunType e m c = do
a <- abstractOfConcrete gr m
lookFun e m c a
lookFun e m c a = do
mu <- lookupModMod gr a
info <- lookupIdentInfo mu c
case info of
AbsFun (Yes ty) _ -> return $ redirectTerm e ty
AbsCat _ _ -> return typeType
AnyInd _ n -> lookFun e m c n
_ -> prtBad "cannot find type of reused function" c
lookupParams :: SourceGrammar -> Ident -> Ident -> Err [Param] lookupParams :: SourceGrammar -> Ident -> Ident -> Err [Param]
lookupParams gr = look True where lookupParams gr = look True where