mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-24 02:12:50 -06:00
changed names of resource-1.3; added a note on homepage on release
This commit is contained in:
12
old-examples/dialogue/Agenda.gf
Normal file
12
old-examples/dialogue/Agenda.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
abstract Agenda = Dialogue, Weekday ** {
|
||||
|
||||
fun
|
||||
Day : Kind ;
|
||||
Meeting : Kind ;
|
||||
Add : Oper2 Meeting Day ;
|
||||
Remove : Oper1 Meeting ;
|
||||
Interrupt : Oper0 ;
|
||||
|
||||
day : WDay -> Object Day ;
|
||||
|
||||
}
|
||||
15
old-examples/dialogue/AgendaEng.gf
Normal file
15
old-examples/dialogue/AgendaEng.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete AgendaEng of Agenda =
|
||||
DialogueEng, WeekdayEng ** open MultiEng, ParadigmsEng in {
|
||||
|
||||
lin
|
||||
Day = UseN (regN "day") ;
|
||||
Meeting = UseN (regN "meeting") ;
|
||||
Add = dirV3 (regV "add") (mkPrep "on") ;
|
||||
Remove = dirV2 (regV "remove") ;
|
||||
Interrupt = regV "interrupt" ;
|
||||
|
||||
day = UsePN ;
|
||||
|
||||
}
|
||||
15
old-examples/dialogue/AgendaFin.gf
Normal file
15
old-examples/dialogue/AgendaFin.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete AgendaFin of Agenda =
|
||||
DialogueFin, WeekdayFin ** open MultiFin, ParadigmsFin in {
|
||||
|
||||
lin
|
||||
Day = UseN (regN "päivä") ;
|
||||
Meeting = UseN (regN "kokous") ;
|
||||
Add = dirV3 (regV "lisätä") translative ;
|
||||
Remove = dirV2 (regV "poistaa") ;
|
||||
Interrupt = regV "keskeyttää" ;
|
||||
|
||||
day = UsePN ;
|
||||
|
||||
}
|
||||
16
old-examples/dialogue/AgendaFre.gf
Normal file
16
old-examples/dialogue/AgendaFre.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete AgendaFre of Agenda =
|
||||
DialogueFre, WeekdayFre ** open MultiFre, ParadigmsFre, IrregFre in {
|
||||
|
||||
lin
|
||||
Day = UseN (regN "jour") ;
|
||||
Meeting = UseN (regN "réunion") ;
|
||||
Add = dirdirV3 (regV "ajouter") ;
|
||||
Remove = dirV2 (regV "ôter") ;
|
||||
Interrupt = interrompre_V2 ;
|
||||
|
||||
day = UsePN ;
|
||||
|
||||
}
|
||||
|
||||
15
old-examples/dialogue/AgendaProlog.gf
Normal file
15
old-examples/dialogue/AgendaProlog.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete AgendaProlog of Agenda =
|
||||
DialogueProlog, WeekdayProlog ** open ResProlog, Prelude in {
|
||||
|
||||
lin
|
||||
Day = ss "day" ;
|
||||
Meeting = ss "meeting" ;
|
||||
Add = op2 "add_event" "event_to_store" "date_to_store" ;
|
||||
Remove = op1 "remove_event" "event_to_remove" ;
|
||||
Interrupt = ss "interrupt" ;
|
||||
|
||||
day = apps "weekday" ;
|
||||
|
||||
}
|
||||
16
old-examples/dialogue/AgendaSwe.gf
Normal file
16
old-examples/dialogue/AgendaSwe.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete AgendaSwe of Agenda =
|
||||
DialogueSwe, WeekdaySwe ** open MultiSwe, ParadigmsSwe, IrregSwe in {
|
||||
|
||||
lin
|
||||
Day = UseN (regN "dag") ;
|
||||
Meeting = UseN (regGenN "möte" neutrum) ;
|
||||
Add = dirV3 (partV lägga_V "till") (mkPrep "på") ;
|
||||
Remove = dirV2 (partV taga_V "bort") ;
|
||||
Interrupt = avbryta_V ;
|
||||
|
||||
day = UsePN ;
|
||||
|
||||
}
|
||||
|
||||
13
old-examples/dialogue/AuxDialogue.gf
Normal file
13
old-examples/dialogue/AuxDialogue.gf
Normal file
@@ -0,0 +1,13 @@
|
||||
interface AuxDialogue = open Multi in {
|
||||
oper
|
||||
defN : N -> NP = \n ->
|
||||
DetCN (DetSg (SgQuant DefArt) NoOrd) (UseN n) ;
|
||||
|
||||
mkMove : Str -> Phr = \s -> {s = variants {
|
||||
s ;
|
||||
s ++ please_Voc.s
|
||||
} ;
|
||||
lock_Phr = <>
|
||||
} ;
|
||||
|
||||
}
|
||||
2
old-examples/dialogue/AuxEng.gf
Normal file
2
old-examples/dialogue/AuxEng.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
instance AuxEng of AuxDialogue = open MultiEng in {
|
||||
}
|
||||
2
old-examples/dialogue/AuxFin.gf
Normal file
2
old-examples/dialogue/AuxFin.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
instance AuxFin of AuxDialogue = open MultiFin in {
|
||||
}
|
||||
2
old-examples/dialogue/AuxFre.gf
Normal file
2
old-examples/dialogue/AuxFre.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
instance AuxFre of AuxDialogue = open MultiFre in {
|
||||
}
|
||||
2
old-examples/dialogue/AuxSwe.gf
Normal file
2
old-examples/dialogue/AuxSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
instance AuxSwe of AuxDialogue = open MultiSwe in {
|
||||
}
|
||||
52
old-examples/dialogue/Dialogue.gf
Normal file
52
old-examples/dialogue/Dialogue.gf
Normal file
@@ -0,0 +1,52 @@
|
||||
abstract Dialogue = {
|
||||
|
||||
flags startcat=Move ;
|
||||
|
||||
cat
|
||||
Move ;
|
||||
Action ;
|
||||
Proposition ;
|
||||
Question ;
|
||||
Kind ;
|
||||
Object Kind ;
|
||||
Oper0 ;
|
||||
Oper1 Kind ;
|
||||
Oper2 Kind Kind ;
|
||||
|
||||
fun
|
||||
IRequest : Action -> Input ;
|
||||
IConfirm : Action -> Input ;
|
||||
IAnswer : Proposition -> Input ;
|
||||
IIssue : Question -> Input ;
|
||||
|
||||
IYes : Input ;
|
||||
INo : Input ;
|
||||
IObject : (k : Kind) -> Object k -> Input ;
|
||||
|
||||
PAction : Action -> Proposition ;
|
||||
|
||||
QKind : Kind -> Question ;
|
||||
|
||||
AOper0 : Oper0 -> Action ;
|
||||
AOper1 : (k : Kind) -> Oper1 k -> Object k -> Action ;
|
||||
AOper2 : (k,m : Kind) -> Oper2 k m -> Object k -> Object m -> Action ;
|
||||
|
||||
OAll : (k : Kind) -> Object k ;
|
||||
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 ;
|
||||
}
|
||||
4
old-examples/dialogue/DialogueEng.gf
Normal file
4
old-examples/dialogue/DialogueEng.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete DialogueEng of Dialogue = DialogueI with
|
||||
(Multi = MultiEng) ;
|
||||
4
old-examples/dialogue/DialogueFin.gf
Normal file
4
old-examples/dialogue/DialogueFin.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete DialogueFin of Dialogue = DialogueI with
|
||||
(Multi = MultiFin) ;
|
||||
4
old-examples/dialogue/DialogueFre.gf
Normal file
4
old-examples/dialogue/DialogueFre.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete DialogueFre of Dialogue = DialogueI with
|
||||
(Multi = MultiFre) ;
|
||||
98
old-examples/dialogue/DialogueI.gf
Normal file
98
old-examples/dialogue/DialogueI.gf
Normal file
@@ -0,0 +1,98 @@
|
||||
incomplete concrete DialogueI of Dialogue = open Multi, Prelude in {
|
||||
|
||||
flags optimize = all_subs ;
|
||||
|
||||
lincat
|
||||
Move = Phr ;
|
||||
Action = {s : ActType => Str ; point : Str} ;
|
||||
Proposition = Utt ; ----
|
||||
Question = Utt ;
|
||||
Kind = CN ;
|
||||
Object = NP ;
|
||||
Oper0 = V ;
|
||||
Oper1 = V2 ;
|
||||
Oper2 = V3 ;
|
||||
|
||||
lin
|
||||
IRequest a = {s = a.s ! ARequest ; point = a.point ; lock_Utt = <>} ;
|
||||
IConfirm a = {s = a.s ! AConfirm ; point = a.point ; lock_Utt = <>} ;
|
||||
IAnswer a = a ;
|
||||
IIssue a = a ;
|
||||
|
||||
IYes = yes_Phr ** noPoint ;
|
||||
INo = no_Phr ** noPoint ;
|
||||
IObject _ ob = UttNP ob ;
|
||||
|
||||
PAction a = {s = a.s ! AConfirm ; point = a.point ; lock_Utt = <>} ;
|
||||
|
||||
QKind k =
|
||||
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) ;
|
||||
OIndef k = DetCN (DetSg (SgQuant IndefArt) NoOrd) k ;
|
||||
ODef k = DetCN (DetSg (SgQuant DefArt) NoOrd) k ;
|
||||
|
||||
param
|
||||
ActType = ARequest | AConfirm ; -- and some others
|
||||
|
||||
oper
|
||||
|
||||
-- this should perhaps be language dependent - but at least these
|
||||
-- variants seem to make sense in all languages
|
||||
|
||||
mkAction : VP -> {s : ActType => Str ; point : Str} = \vp -> {
|
||||
s = table {
|
||||
ARequest => (variants {
|
||||
aImp vp ;
|
||||
aWant vp ;
|
||||
aCanYou vp
|
||||
}).s ;
|
||||
AConfirm => (variants {
|
||||
aInf vp
|
||||
}).s
|
||||
} ;
|
||||
point = vp.point
|
||||
} ;
|
||||
|
||||
optPlease : Voc = variants {NoVoc ; please_Voc} ;
|
||||
|
||||
aImp : VP -> Utt = \vp ->
|
||||
UttImpSg PPos (ImpVP vp) ;
|
||||
|
||||
aWant : VP -> Utt = \vp ->
|
||||
UttS (UseCl TPres ASimul PPos
|
||||
(PredVP (UsePron i_Pron) (ComplVV want_VV vp))) ;
|
||||
|
||||
aCanYou : VP -> Utt = \vp ->
|
||||
UttQS (UseQCl TPres ASimul PPos (QuestCl
|
||||
(PredVP (UsePron youSg_Pron) (ComplVV can_VV vp)))) ;
|
||||
|
||||
aInf : VP -> Utt = \vp ->
|
||||
UttVP vp ;
|
||||
|
||||
-- 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 = []} ;
|
||||
|
||||
}
|
||||
|
||||
42
old-examples/dialogue/DialogueProlog.gf
Normal file
42
old-examples/dialogue/DialogueProlog.gf
Normal file
@@ -0,0 +1,42 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete DialogueProlog of Dialogue = open ResProlog, Prelude in {
|
||||
|
||||
flags lexer=codelit ; unlexer=code ;
|
||||
|
||||
lincat
|
||||
Move = SS ;
|
||||
Action = SS ;
|
||||
Proposition = SS ;
|
||||
Question = SS ;
|
||||
Kind = SS ;
|
||||
Object = SS ;
|
||||
Oper0 = SS ;
|
||||
Oper1 = {s, x : Str} ;
|
||||
Oper2 = {s, x, y : Str} ;
|
||||
|
||||
lin
|
||||
MRequest a = a ;
|
||||
MConfirm a = a ; --- ??
|
||||
MAnswer a = a ; --- ??
|
||||
MIssue a = ss (bracket (app1 "ask" a.s)) ; --- ??
|
||||
|
||||
MYes = ss (bracket (app1 "answer" "yes")) ;
|
||||
MNo = ss (bracket (app1 "answer" "no")) ;
|
||||
MObject _ ob = ss (bracket (apps "answer" ob).s) ;
|
||||
|
||||
QKind k = ss (app2 "q" "X" (app1 k.s "X")) ;
|
||||
|
||||
AOper0 op = ss (bracket (request op.s)) ;
|
||||
AOper1 _ op x = ss (req_ans op.s op.x x.s) ;
|
||||
AOper2 _ _ op x y =
|
||||
ss (bracket (request op.s ++ "," ++
|
||||
answer (app1 op.x x.s) ++ "," ++ answer (app1 op.y y.s))) ;
|
||||
|
||||
OAll = apps "all" ;
|
||||
OIndef = apps "indef" ;
|
||||
ODef = apps "def" ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
4
old-examples/dialogue/DialogueSwe.gf
Normal file
4
old-examples/dialogue/DialogueSwe.gf
Normal file
@@ -0,0 +1,4 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete DialogueSwe of Dialogue = DialogueI with
|
||||
(Multi = MultiSwe) ;
|
||||
16
old-examples/dialogue/Lights.gf
Normal file
16
old-examples/dialogue/Lights.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
abstract Lights = Dialogue ** {
|
||||
|
||||
fun
|
||||
Light : Kind ;
|
||||
Room : Kind ;
|
||||
SwitchOnIn : Oper2 Light Room ;
|
||||
SwitchOffIn : Oper2 Light Room ;
|
||||
SwitchOn : Oper1 Light ;
|
||||
SwitchOff : Oper1 Light ;
|
||||
|
||||
LivingRoom : Object Room ;
|
||||
Kitchen : Object Room ;
|
||||
|
||||
MorningMode : Move ;
|
||||
|
||||
}
|
||||
19
old-examples/dialogue/LightsEng.gf
Normal file
19
old-examples/dialogue/LightsEng.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete LightsEng of Lights =
|
||||
DialogueEng ** open MultiEng, ParadigmsEng, AuxEng, Prelude in {
|
||||
|
||||
lin
|
||||
Light = UseN (regN "light") ;
|
||||
Room = UseN (regN "room") ;
|
||||
SwitchOnIn = dirV3 (partV (regV "switch") "on") (mkPrep "in") ;
|
||||
SwitchOffIn = dirV3 (partV (regV "switch") "off") (mkPrep "in") ;
|
||||
SwitchOn = dirV2 (partV (regV "switch") "on") ;
|
||||
SwitchOff = dirV2 (partV (regV "switch") "off") ;
|
||||
|
||||
LivingRoom = defN (regN ["living-room"]) ;
|
||||
Kitchen = defN (regN ["kitchen"]) ;
|
||||
|
||||
MorningMode = mkMove (optStr "the" ++ ["morning mode"]) ;
|
||||
|
||||
}
|
||||
19
old-examples/dialogue/LightsFin.gf
Normal file
19
old-examples/dialogue/LightsFin.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete LightsFin of Lights =
|
||||
DialogueFin ** open MultiFin, ParadigmsFin, AuxFin in {
|
||||
|
||||
lin
|
||||
Light = UseN (regN "valo") ;
|
||||
Room = UseN (regN "huone") ;
|
||||
SwitchOnIn = dirV3 (regV "sytyttää") inessive ;
|
||||
SwitchOffIn = dirV3 (regV "sammuttaa") inessive ;
|
||||
SwitchOn = dirV2 (regV "sytyttää") ;
|
||||
SwitchOff = dirV2 (regV "sammuttaa") ;
|
||||
|
||||
LivingRoom = defN (regN "olohuone") ;
|
||||
Kitchen = defN (regN "keittiö") ;
|
||||
|
||||
MorningMode = mkMove ["aamuvalaistus"] ;
|
||||
|
||||
}
|
||||
19
old-examples/dialogue/LightsFre.gf
Normal file
19
old-examples/dialogue/LightsFre.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
concrete LightsFre of Lights =
|
||||
DialogueFre ** open MultiFre, ParadigmsFre, IrregFre, AuxFre in {
|
||||
|
||||
lin
|
||||
Light = UseN (regN "lampe") ;
|
||||
Room = UseN (regN "chambre") ;
|
||||
SwitchOnIn = dirV3 (regV "allumer") (mkPrep "dans") ;
|
||||
SwitchOffIn = dirV3 éteindre_V2 (mkPrep "dans") ;
|
||||
SwitchOn = dirV2 (regV "allumer") ;
|
||||
SwitchOff = dirV2 éteindre_V2 ;
|
||||
|
||||
LivingRoom = defN (regN "salon") ;
|
||||
Kitchen = defN (regN "cuisine") ;
|
||||
|
||||
MorningMode = mkMove ["le mode matinal"] ;
|
||||
|
||||
}
|
||||
20
old-examples/dialogue/LightsProlog.gf
Normal file
20
old-examples/dialogue/LightsProlog.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
concrete LightsProlog of Lights =
|
||||
DialogueProlog ** open ResProlog, Prelude in {
|
||||
|
||||
lin
|
||||
Light = ss "light" ;
|
||||
Room = ss "room" ;
|
||||
SwitchOnIn = op2 "switch_on" "switch_what" "switch_where" ;
|
||||
SwitchOffIn = op2 "switch_off" "switch_what" "switch_where" ;
|
||||
SwitchOn = op1 "switch_on" "switch_what" ;
|
||||
SwitchOff = op1 "switch_off" "switch_what" ;
|
||||
|
||||
LivingRoom = ss "living_room" ;
|
||||
Kitchen = ss "kitchen" ;
|
||||
|
||||
MorningMode = ss (bracket (app1 "answer" "morning_mode")) ;
|
||||
|
||||
}
|
||||
|
||||
20
old-examples/dialogue/LightsSwe.gf
Normal file
20
old-examples/dialogue/LightsSwe.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
--# -path=.:multimodal:alltenses:prelude
|
||||
|
||||
|
||||
concrete LightsSwe of Lights =
|
||||
DialogueSwe ** open MultiSwe, ParadigmsSwe, AuxSwe in {
|
||||
|
||||
lin
|
||||
Light = UseN (regN "lampa") ;
|
||||
Room = UseN (mkN "rum" "rummet" "rum" "rummen") ;
|
||||
SwitchOnIn = dirV3 (regV "tänder") (mkPrep "i") ;
|
||||
SwitchOffIn = dirV3 (regV "släcker") (mkPrep "i") ;
|
||||
SwitchOn = dirV2 (regV "tänder") ;
|
||||
SwitchOff = dirV2 (regV "släcker") ;
|
||||
|
||||
LivingRoom = defN (mkN "vardagsrum" "vardagsrummet" "vardagsrum" "vardagsrummen") ;
|
||||
Kitchen = defN (mk2N "kök" "kök") ;
|
||||
|
||||
MorningMode = mkMove ["morgonläget"] ;
|
||||
|
||||
}
|
||||
14
old-examples/dialogue/Makefile
Normal file
14
old-examples/dialogue/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
lights:
|
||||
echo "s ;; pm | wf lights.gfcm" | gf Lights*.gf
|
||||
|
||||
agenda:
|
||||
echo "s ;; pm | wf agenda.gfcm" | gf Agenda*.gf
|
||||
|
||||
engcorpus:
|
||||
echo "gt -depth=4 | pt -transform=typecheck | l -all" | gf LightsEng.gf
|
||||
|
||||
swecorpus:
|
||||
echo "gt -depth=4 | pt -transform=typecheck | l -all" | gf LightsSwe.gf
|
||||
|
||||
doc:
|
||||
txt2tags -thtml -ogf-dialogue.html README.txt
|
||||
99
old-examples/dialogue/README.txt
Normal file
99
old-examples/dialogue/README.txt
Normal file
@@ -0,0 +1,99 @@
|
||||
Dialogue system grammars using GF resource.
|
||||
|
||||
AR 16/5/2006
|
||||
|
||||
|
||||
24/5 Added multimodality.
|
||||
|
||||
==Functionality and purpose==
|
||||
|
||||
Dialogue system abstract syntax + concrete syntaxes for
|
||||
different languages. One of them is Prolog (with some resemblance to
|
||||
dialogue moves in GoDiS).
|
||||
|
||||
The purpose is to show how new systems can be built for new domains just
|
||||
by specifying just two things:
|
||||
- a domain ontology in abstract syntax
|
||||
- a domain terminologies in concrete syntaxes
|
||||
|
||||
|
||||
This is based on two library elements
|
||||
- base dialogue grammars
|
||||
- resource grammar libraries
|
||||
|
||||
|
||||
In general, the only kind of elements that need to be added are
|
||||
constants (0-place fun's) of the following categories from Dialogue.gf.
|
||||
```
|
||||
Kind ; -- e.g. Room
|
||||
Object Kind ; -- e.g. Kitchen
|
||||
Oper0 ; -- e.g. Stop
|
||||
Oper1 Kind ; -- e.g. Play
|
||||
Oper2 Kind Kind ; -- e.g. Add
|
||||
Move ; -- e.g. MorningMode
|
||||
```
|
||||
|
||||
|
||||
==Files in this directory==
|
||||
|
||||
Files (for X = Eng, Fin, Fre, Prolog, Swe):
|
||||
|
||||
Files provided as library to build on:
|
||||
```
|
||||
Dialogue.gf -- base dialogue grammar
|
||||
DialogueX.gf -- implementation instance
|
||||
DialogueI.gf -- implementation functor
|
||||
|
||||
ResProlog.gf -- help constructs for Prolog terms
|
||||
|
||||
Weekday.gf -- untility grammar with weekdays
|
||||
WeekdayX.gf
|
||||
|
||||
AuxDialogue.gf-- interface of auxiliary resource-defined opers
|
||||
AuxX.gf -- instances for different languages
|
||||
```
|
||||
Files implementing two examples.
|
||||
```
|
||||
Agenda.gf -- application grammar for agenda
|
||||
AgendaX.gf
|
||||
|
||||
Lights.gf -- application grammar for lights
|
||||
Lights.gf
|
||||
```
|
||||
|
||||
==Files needed to build a new application==
|
||||
|
||||
To build a new application for domain Dom, you thus need
|
||||
```
|
||||
Dom.gf -- introduce fun's in Kind, Object, Oper0, Oper1, Oper2
|
||||
DomX.gf -- concrete syntax of the new fun's for language X
|
||||
```
|
||||
|
||||
==Some tests==
|
||||
|
||||
You first need to do, with the latest resource grammar version,
|
||||
- ``make present`` in ``lib/resource-1.0``
|
||||
|
||||
To test an application in GF, do e.g.
|
||||
- ``make lights`` to make a package with all the Lights grammars
|
||||
- ``make engcorpus`` to generate an English corpus
|
||||
- ``make swecorpus`` to generate a Swedish corpus
|
||||
|
||||
|
||||
|
||||
Here are some other commands:
|
||||
- ``i LightsEng.gf`` in current dir, to load a grammar
|
||||
- ``gr | l -all`` to random-generate
|
||||
- ``gt -depth=4 | pt -transform=typecheck | l -all`` to generate a corpus
|
||||
- ``p "switch off all lights in the kitchen"`` to parse
|
||||
- ``i LightsProlog.gf`` to load the Prolog version
|
||||
- ``pg -printer=gsl -startcat=Move`` to print a Nuance grammar
|
||||
- ``p -lang=LightsEng "switch off all lights" | pt -transform=solve | l -lang=LightsProlog``
|
||||
to translate from English to Prolog
|
||||
- ``si -tr -lang=LightsEng | p -cat=Move -lang=LightsEng | pt -transform=solve | l -lang=LightsProlog``
|
||||
to translate English speech into Prolog
|
||||
|
||||
|
||||
The last one is the coolest - but you may need to enable the ``speech_input`` command by installing ATK
|
||||
and recompiling GF.
|
||||
|
||||
22
old-examples/dialogue/ResProlog.gf
Normal file
22
old-examples/dialogue/ResProlog.gf
Normal file
@@ -0,0 +1,22 @@
|
||||
resource ResProlog = open Prelude in {
|
||||
|
||||
oper
|
||||
bracket : Str -> Str = \s -> "[" ++ s ++ "]" ;
|
||||
|
||||
app1 : Str -> Str -> Str = \f,x -> f ++ paren x ;
|
||||
app2 : Str -> Str -> Str -> Str = \f,x,y -> f ++ paren (x ++ "," ++ y) ;
|
||||
|
||||
apps : Str -> SS -> SS = \f,x -> ss (app1 f x.s) ;
|
||||
|
||||
op1 : (s,x : Str) -> {s,x : Str} = \s,x -> {s = s ; x = x} ;
|
||||
op2 : (s,x,y : Str) -> {s,x,y : Str} = \s,x,y -> {s = s ; x = x ; y = y} ;
|
||||
|
||||
request : Str -> Str = app1 "request" ;
|
||||
answer : Str -> Str = app1 "answer" ;
|
||||
|
||||
req_ans : Str -> Str -> Str -> Str = \f,t,k ->
|
||||
bracket (request f ++ "," ++ answer (app1 t k)) ;
|
||||
|
||||
}
|
||||
|
||||
-- [request(add_event), answer(event_to_store(meeting))]
|
||||
8
old-examples/dialogue/Weekday.gf
Normal file
8
old-examples/dialogue/Weekday.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
abstract Weekday = {
|
||||
cat
|
||||
WDay ;
|
||||
|
||||
fun
|
||||
Mon, Tue : WDay ;
|
||||
|
||||
}
|
||||
10
old-examples/dialogue/WeekdayEng.gf
Normal file
10
old-examples/dialogue/WeekdayEng.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete WeekdayEng of Weekday = open LangEng, ParadigmsEng in {
|
||||
|
||||
lincat
|
||||
WDay = PN ;
|
||||
|
||||
lin
|
||||
Mon = regGenPN "Monday" nonhuman ;
|
||||
Tue = regGenPN "Tuesday" nonhuman ;
|
||||
|
||||
}
|
||||
10
old-examples/dialogue/WeekdayFin.gf
Normal file
10
old-examples/dialogue/WeekdayFin.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete WeekdayFin of Weekday = open LangFin, ParadigmsFin in {
|
||||
|
||||
lincat
|
||||
WDay = PN ;
|
||||
|
||||
lin
|
||||
Mon = mkPN (regN "maanantai") ;
|
||||
Tue = mkPN (regN "tiistai") ;
|
||||
|
||||
}
|
||||
10
old-examples/dialogue/WeekdayFre.gf
Normal file
10
old-examples/dialogue/WeekdayFre.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete WeekdayFre of Weekday = open LangFre, ParadigmsFre in {
|
||||
|
||||
lincat
|
||||
WDay = PN ;
|
||||
|
||||
lin
|
||||
Mon = mkPN "lundi" masculine ;
|
||||
Tue = mkPN "mardi" masculine ;
|
||||
|
||||
}
|
||||
10
old-examples/dialogue/WeekdayProlog.gf
Normal file
10
old-examples/dialogue/WeekdayProlog.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete WeekdayProlog of Weekday = open ResProlog, Prelude in {
|
||||
|
||||
lincat
|
||||
WDay = SS ;
|
||||
|
||||
lin
|
||||
Mon = ss "monday" ;
|
||||
Tue = ss "tuesday" ;
|
||||
|
||||
}
|
||||
10
old-examples/dialogue/WeekdaySwe.gf
Normal file
10
old-examples/dialogue/WeekdaySwe.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete WeekdaySwe of Weekday = open LangSwe, ParadigmsSwe in {
|
||||
|
||||
lincat
|
||||
WDay = PN ;
|
||||
|
||||
lin
|
||||
Mon = regGenPN "måndag" utrum ;
|
||||
Tue = regGenPN "tisdag" utrum ;
|
||||
|
||||
}
|
||||
124
old-examples/dialogue/gf-dialogue.html
Normal file
124
old-examples/dialogue/gf-dialogue.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
||||
<TITLE>Dialogue system grammars using GF resource.</TITLE>
|
||||
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
||||
<P ALIGN="center"><CENTER><H1>Dialogue system grammars using GF resource.</H1>
|
||||
<FONT SIZE="4">
|
||||
AR 16/5/2006
|
||||
</FONT></CENTER>
|
||||
|
||||
<H2>Functionality and purpose</H2>
|
||||
<P>
|
||||
Dialogue system abstract syntax + concrete syntaxes for
|
||||
different languages. One of them is Prolog (with some resemblance to
|
||||
dialogue moves in GoDiS).
|
||||
</P>
|
||||
<P>
|
||||
The purpose is to show how new systems can be built for new domains just
|
||||
by specifying just two things:
|
||||
</P>
|
||||
<UL>
|
||||
<LI>a domain ontology in abstract syntax
|
||||
<LI>a domain terminologies in concrete syntaxes
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
This is based on two library elements
|
||||
</P>
|
||||
<UL>
|
||||
<LI>base dialogue grammars
|
||||
<LI>resource grammar libraries
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
In general, the only kind of elements that need to be added are
|
||||
constants (0-place fun's) of the following categories from Dialogue.gf.
|
||||
</P>
|
||||
<PRE>
|
||||
Kind ; -- e.g. Room
|
||||
Object Kind ; -- e.g. Kitchen
|
||||
Oper0 ; -- e.g. Stop
|
||||
Oper1 Kind ; -- e.g. Play
|
||||
Oper2 Kind Kind ; -- e.g. Add
|
||||
Move ; -- e.g. MorningMode
|
||||
</PRE>
|
||||
<P></P>
|
||||
<H2>Files in this directory</H2>
|
||||
<P>
|
||||
Files (for X = Eng, Fin, Fre, Prolog, Swe):
|
||||
</P>
|
||||
<P>
|
||||
Files provided as library to build on:
|
||||
</P>
|
||||
<PRE>
|
||||
Dialogue.gf -- base dialogue grammar
|
||||
DialogueX.gf -- implementation instance
|
||||
DialogueI.gf -- implementation functor
|
||||
|
||||
ResProlog.gf -- help constructs for Prolog terms
|
||||
|
||||
Weekday.gf -- untility grammar with weekdays
|
||||
WeekdayX.gf
|
||||
|
||||
AuxDialogue.gf-- interface of auxiliary resource-defined opers
|
||||
AuxX.gf -- instances for different languages
|
||||
</PRE>
|
||||
<P>
|
||||
Files implementing two examples.
|
||||
</P>
|
||||
<PRE>
|
||||
Agenda.gf -- application grammar for agenda
|
||||
AgendaX.gf
|
||||
|
||||
Lights.gf -- application grammar for lights
|
||||
Lights.gf
|
||||
</PRE>
|
||||
<P></P>
|
||||
<H2>Files needed to build a new application</H2>
|
||||
<P>
|
||||
To build a new application for domain Dom, you thus need
|
||||
</P>
|
||||
<PRE>
|
||||
Dom.gf -- introduce fun's in Kind, Object, Oper0, Oper1, Oper2
|
||||
DomX.gf -- concrete syntax of the new fun's for language X
|
||||
</PRE>
|
||||
<P></P>
|
||||
<H2>Some tests</H2>
|
||||
<P>
|
||||
You first need to do, with the latest resource grammar version,
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>make present</CODE> in <CODE>lib/resource-1.0</CODE>
|
||||
<P></P>
|
||||
To test an application in GF, do e.g.
|
||||
<LI><CODE>make lights</CODE> to make a package with all the Lights grammars
|
||||
<LI><CODE>make engcorpus</CODE> to generate an English corpus
|
||||
<LI><CODE>make swecorpus</CODE> to generate a Swedish corpus
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
Here are some other commands:
|
||||
</P>
|
||||
<UL>
|
||||
<LI><CODE>i LightsEng.gf</CODE> in current dir, to load a grammar
|
||||
<LI><CODE>gr | l -all</CODE> to random-generate
|
||||
<LI><CODE>gt -depth=4 | pt -transform=typecheck | l -all</CODE> to generate a corpus
|
||||
<LI><CODE>p "switch off all lights in the kitchen"</CODE> to parse
|
||||
<LI><CODE>i LightsProlog.gf</CODE> to load the Prolog version
|
||||
<LI><CODE>pg -printer=gsl -startcat=Move</CODE> to print a Nuance grammar
|
||||
<LI><CODE>p -lang=LightsEng "switch off all lights" | pt -transform=solve | l -lang=LightsProlog</CODE>
|
||||
to translate from English to Prolog
|
||||
<LI><CODE>si -tr -lang=LightsEng | p -cat=Move -lang=LightsEng | pt -transform=solve | l -lang=LightsProlog</CODE>
|
||||
to translate English speech into Prolog
|
||||
</UL>
|
||||
|
||||
<P>
|
||||
The last one is the coolest - but you may need to enable the <CODE>speech_input</CODE> command by installing ATK
|
||||
and recompiling GF.
|
||||
</P>
|
||||
|
||||
<!-- html code generated by txt2tags 2.3 (http://txt2tags.sf.net) -->
|
||||
<!-- cmdline: txt2tags -thtml -ogf-dialogue.html README.txt -->
|
||||
</BODY></HTML>
|
||||
Reference in New Issue
Block a user