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
defN : N -> NP = \n ->
defN : N -> NP = \n ->
DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN n) ;
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 ;
fun
MRequest : Action -> Move ;
MConfirm : Action -> Move ;
MAnswer : Proposition -> Move ;
MIssue : Question -> Move ;
IRequest : Action -> Input ;
IConfirm : Action -> Input ;
IAnswer : Proposition -> Input ;
IIssue : Question -> Input ;
MYes : Move ;
MNo : Move ;
MObject : (k : Kind) -> Object k -> Move ;
IYes : Input ;
INo : Input ;
IObject : (k : Kind) -> Object k -> Input ;
PAction : Action -> Proposition ;
@@ -35,5 +35,18 @@ abstract Dialogue = {
OIndef : (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
(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
Move = Phr ;
Action = {s : ActType => Str} ;
Proposition = Phr ; ----
Question = Phr ;
Action = {s : ActType => Str ; point : Str} ;
Proposition = Utt ; ----
Question = Utt ;
Kind = CN ;
Object = NP ;
Oper0 = V ;
@@ -12,26 +12,26 @@ incomplete concrete DialogueI of Dialogue = open Lang, Prelude in {
Oper2 = V3 ;
lin
MRequest a = ss (a.s ! ARequest) ;
MConfirm a = ss (a.s ! AConfirm) ;
MAnswer a = a ;
MIssue a = a ;
IRequest a = {s = a.s ! ARequest ; point = a.point} ;
IConfirm a = {s = a.s ! AConfirm ; point = a.point} ;
IAnswer a = a ;
IIssue a = a ;
MYes = yes_Phr ;
MNo = no_Phr ;
MObject _ ob = PhrUtt NoPConj (UttNP ob) optPlease ;
IYes = yes_Phr ** noPoint ;
INo = no_Phr ** noPoint ;
IObject _ ob = UttNP ob ;
PAction a = ss (a.s ! AConfirm) ;
PAction a = {s = a.s ! AConfirm ; point = a.point} ;
QKind k =
PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos
(ExistIP (IDetCN whichPl_IDet NoNum NoOrd k)))) NoVoc ;
UttQS (UseQCl TPres ASimul PPos
(ExistIP (IDetCN whichPl_IDet NoNum NoOrd k))) ;
AOper0 op = mkAction (UseV op) ;
AOper1 _ op x = mkAction (ComplV2 op x) ;
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 ;
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
-- variants seem to make sense in all languages
mkAction : VP -> {s : ActType => Str} = \vp -> {
mkAction : VP -> {s : ActType => Str ; point : Str} = \vp -> {
s = table {
ARequest => variants {
ARequest => (variants {
aImp vp ;
aWant vp ;
aCanYou vp
} ;
AConfirm => variants {
}).s ;
AConfirm => (variants {
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 ->
(PhrUtt NoPConj (UttImpSg PPos (ImpVP vp)) optPlease).s ;
aWant : VP -> Utt = \vp ->
UttS (UseCl TPres ASimul PPos
(PredVP (UsePron i_Pron) (ComplVV want_VV vp))) ;
aWant : VP -> Str = \vp ->
(PhrUtt NoPConj (UttS (UseCl TPres ASimul PPos (PredVP (UsePron i_Pron)
(ComplVV want_VV vp)))) optPlease).s ;
aCanYou : VP -> Utt = \vp ->
UttQS (UseQCl TPres ASimul PPos (QuestCl
(PredVP (UsePron youSg_Pron) (ComplVV can_VV vp)))) ;
aCanYou : VP -> Str = \vp ->
(PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos (QuestCl (PredVP
(UsePron youSg_Pron) (ComplVV can_VV vp))))) optPlease).s ;
aInf : VP -> Utt = \vp ->
UttVP vp ;
aInf : VP -> Str = \vp ->
(PhrUtt NoPConj (UttVP vp) NoVoc).s ;
-- multimodality
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 =
DialogueEng ** open LangEng, ParadigmsEng, AuxEng, Prelude in {
DialogueEng ** open MultiEng, ParadigmsEng, AuxEng, Prelude in {
lin
Light = UseN (regN "light") ;

View File

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

View File

@@ -72,19 +72,25 @@ lookupResType gr m c = do
CncFun (Just (cat,(cont,val))) _ _ -> do
val' <- return val ---- lockRecType cat val
return $ mkProd (cont, val', [])
CncFun _ _ _ -> do
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
CncFun _ _ _ -> lookFunType m m c
AnyInd _ n -> lookupResType gr n c
ResParam _ -> return $ typePType
ResValue (Yes t) -> return $ qualifAnnotPar m t
_ -> Bad $ prt c +++ "has no type defined in resource" +++ prt m
_ -> 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 gr = look True where