mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
updated resource example
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
abstract Animals = {
|
-- The Question grammar specialized to animals.
|
||||||
cat
|
|
||||||
Phrase ; Animal ; Action ;
|
|
||||||
fun
|
|
||||||
Who : Action -> Animal -> Phrase ;
|
|
||||||
Whom : Animal -> Action -> Phrase ;
|
|
||||||
Answer : Animal -> Action -> Animal -> Phrase ;
|
|
||||||
|
|
||||||
Dog, Cat, Mouse, Lion, Zebra : Animal ;
|
abstract Animals = Questions ** {
|
||||||
|
|
||||||
|
fun
|
||||||
|
-- a lexicon of animals and actions among them
|
||||||
|
Dog, Cat, Mouse, Lion, Zebra : Entity ;
|
||||||
Chase, Eat, Like : Action ;
|
Chase, Eat, Like : Action ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,15 @@
|
|||||||
--# -path=.:resource/english:resource/abstract:resource/../prelude
|
--# -path=.:resource/english:resource/abstract:resource/../prelude
|
||||||
|
|
||||||
concrete AnimalsEng of Animals = open ResourceEng, ParadigmsEng, VerbsEng in {
|
concrete AnimalsEng of Animals = QuestionsEng **
|
||||||
lincat
|
open ResourceEng, ParadigmsEng, VerbsEng in {
|
||||||
Phrase = Phr ;
|
|
||||||
Animal = N ;
|
|
||||||
Action = V2 ;
|
|
||||||
lin
|
lin
|
||||||
Who act obj = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(QPredV2 who8one_IP act (IndefNumNP NoNum (UseN obj)))) ;
|
|
||||||
Whom subj act = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(IntSlash who8one_IP (SlashV2 (DefOneNP (UseN subj)) act))) ;
|
|
||||||
Answer subj act obj = IndicPhrase (UseCl (PosTP TPresent ASimul)
|
|
||||||
(SPredV2 (DefOneNP (UseN subj)) act (IndefNumNP NoNum (UseN obj)))) ;
|
|
||||||
Dog = regN "dog" ;
|
Dog = regN "dog" ;
|
||||||
Cat = regN "cat" ;
|
Cat = regN "cat" ;
|
||||||
Mouse = mk2N "mouse" "mice" ;
|
Mouse = mk2N "mouse" "mice" ;
|
||||||
Lion = regN "lion" ;
|
Lion = regN "lion" ;
|
||||||
Zebra = regN "zebra" ;
|
Zebra = regN "zebra" ;
|
||||||
Chase = dirV2 (regV "chase") ;
|
Chase = dirV2 (regV "chase") ;
|
||||||
Eat = dirV2 (eat_V ** {lock_V = <>}) ;
|
Eat = dirV2 eat_V ;
|
||||||
Like = dirV2 (regV "like") ;
|
Like = dirV2 (regV "like") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{-
|
|
||||||
> p -cat=Phr "who likes cars ?"
|
|
||||||
|
|
||||||
QuestPhrase (UseQCl (PosTP TPresent ASimul) (QPredV2 who8one_IP like_V2 (IndefNumNP NoNum (UseN car_N))))
|
|
||||||
|
|
||||||
QuestPhrase (UseQCl (PosTP TPresent ASimul) (IntSlash who8one_IP (SlashV2 (DefOneNP (UseN car_N)) like_V2)))
|
|
||||||
|
|
||||||
> p -cat=Phr "the house likes cars ."
|
|
||||||
|
|
||||||
IndicPhrase (UseCl (PosTP TPresent ASimul) (SPredV2 (DefOneNP (UseN house_N)) like_V2 (IndefNumNP NoNum (UseN car_N))))
|
|
||||||
|
|
||||||
-}
|
|
||||||
@@ -1,21 +1,9 @@
|
|||||||
--# -path=.:resource/french:resource/romance:resource/abstract:resource/../prelude
|
--# -path=.:resource/french:resource/romance:resource/abstract:resource/../prelude
|
||||||
|
|
||||||
concrete AnimalsFre of Animals =
|
concrete AnimalsFre of Animals = QuestionsFre **
|
||||||
open
|
open ResourceFre, ParadigmsFre, VerbsFre in {
|
||||||
--- ResourceFre,
|
|
||||||
RulesFre, StructuralFre, VerbphraseFre,
|
|
||||||
ParadigmsFre, VerbsFre in {
|
|
||||||
lincat
|
|
||||||
Phrase = Phr ;
|
|
||||||
Animal = N ;
|
|
||||||
Action = V2 ;
|
|
||||||
lin
|
lin
|
||||||
Who act obj = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(IntVP who8one_IP (ComplV2 act (DefNumNP NoNum (UseN obj))))) ;
|
|
||||||
Whom subj act = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(IntSlash who8one_IP (SlashV2 (DefOneNP (UseN subj)) act))) ;
|
|
||||||
Answer subj act obj = IndicPhrase (UseCl (PosTP TPresent ASimul)
|
|
||||||
(PredVP (DefOneNP (UseN subj)) (ComplV2 act (DefNumNP NoNum (UseN obj))))) ;
|
|
||||||
Dog = regN "chien" masculine ;
|
Dog = regN "chien" masculine ;
|
||||||
Cat = regN "chat" masculine ;
|
Cat = regN "chat" masculine ;
|
||||||
Mouse = regN "souris" feminine ;
|
Mouse = regN "souris" feminine ;
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
--# -path=.:resource/swedish:resource/scandinavian:resource/abstract:resource/../prelude
|
--# -path=.:resource/swedish:resource/scandinavian:resource/abstract:resource/../prelude
|
||||||
|
|
||||||
concrete AnimalsSwe of Animals = open ResourceSwe, ParadigmsSwe, VerbsSwe in {
|
concrete AnimalsSwe of Animals = QuestionsSwe **
|
||||||
lincat
|
open ResourceSwe, ParadigmsSwe, VerbsSwe in {
|
||||||
Phrase = Phr ;
|
|
||||||
Animal = N ;
|
|
||||||
Action = V2 ;
|
|
||||||
lin
|
lin
|
||||||
Who act obj = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(QPredV2 who8one_IP act (IndefNumNP NoNum (UseN obj)))) ;
|
|
||||||
Whom subj act = QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
|
||||||
(IntSlash who8one_IP (SlashV2 (DefOneNP (UseN subj)) act))) ;
|
|
||||||
Answer subj act obj = IndicPhrase (UseCl (PosTP TPresent ASimul)
|
|
||||||
(SPredV2 (DefOneNP (UseN subj)) act (IndefNumNP NoNum (UseN obj)))) ;
|
|
||||||
Dog = regN "hund" utrum ;
|
Dog = regN "hund" utrum ;
|
||||||
Cat = mk2N "katt" "katter" ;
|
Cat = mk2N "katt" "katter" ;
|
||||||
Mouse = mkN "mus" "musen" "möss" "mössen" ;
|
Mouse = mkN "mus" "musen" "möss" "mössen" ;
|
||||||
|
|||||||
10
lib/resource/doc/example/Questions.gf
Normal file
10
lib/resource/doc/example/Questions.gf
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
-- Simple questions and answers, in present tense.
|
||||||
|
|
||||||
|
abstract Questions = {
|
||||||
|
cat
|
||||||
|
Phrase ; Entity ; Action ;
|
||||||
|
fun
|
||||||
|
Who : Action -> Entity -> Phrase ; -- who chases X
|
||||||
|
Whom : Entity -> Action -> Phrase ; -- whom does X chase
|
||||||
|
Answer : Entity -> Action -> Entity -> Phrase ; -- X chases Y
|
||||||
|
}
|
||||||
2
lib/resource/doc/example/QuestionsEng.gf
Normal file
2
lib/resource/doc/example/QuestionsEng.gf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
concrete QuestionsEng of Questions = QuestionsI with
|
||||||
|
(Resource = ResourceEng) ;
|
||||||
2
lib/resource/doc/example/QuestionsFre.gf
Normal file
2
lib/resource/doc/example/QuestionsFre.gf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
concrete QuestionsFre of Questions = QuestionsI with
|
||||||
|
(Resource = ResourceFre) ;
|
||||||
20
lib/resource/doc/example/QuestionsI.gf
Normal file
20
lib/resource/doc/example/QuestionsI.gf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
--# -path=.:resource/abstract:resource/../prelude
|
||||||
|
|
||||||
|
-- Language-independent question grammar parametwized on Resource.
|
||||||
|
|
||||||
|
incomplete concrete QuestionsI of Questions = open Resource in {
|
||||||
|
lincat
|
||||||
|
Phrase = Phr ;
|
||||||
|
Entity = N ;
|
||||||
|
Action = V2 ;
|
||||||
|
lin
|
||||||
|
Who act obj =
|
||||||
|
QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
||||||
|
(QPredV2 who8one_IP act (IndefNumNP NoNum (UseN obj)))) ;
|
||||||
|
Whom subj act =
|
||||||
|
QuestPhrase (UseQCl (PosTP TPresent ASimul)
|
||||||
|
(IntSlash who8one_IP (SlashV2 (DefOneNP (UseN subj)) act))) ;
|
||||||
|
Answer subj act obj =
|
||||||
|
IndicPhrase (UseCl (PosTP TPresent ASimul)
|
||||||
|
(SPredV2 (DefOneNP (UseN subj)) act (IndefNumNP NoNum (UseN obj)))) ;
|
||||||
|
}
|
||||||
2
lib/resource/doc/example/QuestionsSwe.gf
Normal file
2
lib/resource/doc/example/QuestionsSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
concrete QuestionsSwe of Questions = QuestionsI with
|
||||||
|
(Resource = ResourceSwe) ;
|
||||||
@@ -505,20 +505,21 @@ Test with random generation, translation, morphological analysis...
|
|||||||
<!-- NEW -->
|
<!-- NEW -->
|
||||||
<h2>Use as top-level grammar: language learning quizzes</h2>
|
<h2>Use as top-level grammar: language learning quizzes</h2>
|
||||||
|
|
||||||
Morpho quiz with words:
|
Morpho quiz with words (e.g. French verbs):
|
||||||
<pre>
|
<pre>
|
||||||
i
|
i french/VerbsFre.gf
|
||||||
|
mq -cat=V
|
||||||
</pre>
|
</pre>
|
||||||
Morpho quiz with phrases:
|
Morpho quiz with phrases (e.g. Swedish clauses):
|
||||||
<pre>
|
<pre>
|
||||||
|
i swedish/LangSwe.gf
|
||||||
|
mq -cat=Cl
|
||||||
</pre>
|
</pre>
|
||||||
Translation quiz with sentences:
|
Translation quiz with sentences (e.g. sentences from English to Swedish):
|
||||||
<pre>
|
<pre>
|
||||||
|
i swedish/LangEng.gf
|
||||||
|
i swedish/LangSwe.gf
|
||||||
|
tq -cat=S LangEng LangSwe
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
@@ -580,21 +581,35 @@ Source modules:
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
Abstract syntax:
|
||||||
|
<a href=example/Questions.gf>Questions</a>,
|
||||||
<a href=example/Animals.gf>Animals</a>
|
<a href=example/Animals.gf>Animals</a>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
Concrete syntax of questions parametrized on the resource API:
|
||||||
|
<a href=example/QuestionsI.gf>QuestionsI</a>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
English concrete syntax:
|
||||||
|
<a href=example/QuestionsEng.gf>QuestionsEng</a>,
|
||||||
<a href=example/AnimalsEng.gf>AnimalsEng</a>
|
<a href=example/AnimalsEng.gf>AnimalsEng</a>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
French concrete syntax:
|
||||||
|
<a href=example/QuestionsFre.gf>QuestionsFre</a>,
|
||||||
<a href=example/AnimalsFre.gf>AnimalsFre</a>
|
<a href=example/AnimalsFre.gf>AnimalsFre</a>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
Swedish concrete syntax:
|
||||||
|
<a href=example/QuestionsSwe.gf>QuestionsSwe</a>,
|
||||||
<a href=example/AnimalsSwe.gf>AnimalsSwe</a>
|
<a href=example/AnimalsSwe.gf>AnimalsSwe</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- NEW -->
|
<!-- NEW -->
|
||||||
<h2>Compiling the example application</h2>
|
<h2>Compiling the example application</h2>
|
||||||
|
|
||||||
@@ -667,18 +682,23 @@ In two language families:
|
|||||||
<h2>Current status</h2>
|
<h2>Current status</h2>
|
||||||
|
|
||||||
<table border=1>
|
<table border=1>
|
||||||
<tr><td>Language</td> <td>v0.6</td> <td>API</td> <td>Paradigms</td> <td>Basic lex</td> <td>Verbs</td></tr>
|
<tr><td>Language</td> <td>v0.6</td> <td>v0.9 API</td> <td>Paradigms</td> <td>Basic lex</td> <td>Verbs</td></tr>
|
||||||
<tr><td>Danish</td> <td> </td> <td>X</td> <td> </td> <td> </td> <td> </tr>
|
<tr><td>Danish</td> <td>-</td> <td>X</td> <td>-</td> <td>-</td> <td>-</tr>
|
||||||
<tr><td>English</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
<tr><td>English</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
<tr><td>Finnish</td> <td>X</td> <td> </td> <td> </td> <td> </td> <td> </tr>
|
<tr><td>Finnish</td> <td>X</td> <td>-</td> <td>-</td> <td>-</td> <td>-</tr>
|
||||||
<tr><td>French</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
<tr><td>French</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
<tr><td>German</td> <td>X</td> <td> </td> <td>*</td> <td> </td> <td> </tr>
|
<tr><td>German</td> <td>X</td> <td>-</td> <td>*</td> <td>-</td> <td>-</tr>
|
||||||
<tr><td>Italian</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
<tr><td>Italian</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
<tr><td>Norwegian</td> <td> </td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
<tr><td>Norwegian</td> <td>-</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
<tr><td>Russian</td> <td>X</td> <td>*</td> <td>*</td> <td> </td> <td> </tr>
|
<tr><td>Russian</td> <td>X</td> <td>*</td> <td>*</td> <td>-</td> <td>-</tr>
|
||||||
<tr><td>Spanish</td> <td> </td> <td>X</td> <td>X</td> <td> </td> <td>X</tr>
|
<tr><td>Spanish</td> <td>-</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
<tr><td>Swedish</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
<tr><td>Swedish</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>X</tr>
|
||||||
</table>
|
</table>
|
||||||
|
X = implemented (few exceptions may occur)
|
||||||
|
<br>
|
||||||
|
* = linguistic material ready for implementation
|
||||||
|
<br>
|
||||||
|
- = not implemented
|
||||||
|
|
||||||
|
|
||||||
<!-- NEW -->
|
<!-- NEW -->
|
||||||
@@ -720,15 +740,10 @@ Swedish
|
|||||||
<!-- NEW -->
|
<!-- NEW -->
|
||||||
<h2>Obtaining it</h2>
|
<h2>Obtaining it</h2>
|
||||||
|
|
||||||
Now on CVS at Chalmers:
|
Get the grammar package atDownload from
|
||||||
<pre>
|
<a href="http://sourceforge.net/project/showfiles.php?group_id=132285">
|
||||||
cvs -d /users/cs/aarne/cvs checkout GF2.0/lib
|
GF Download Page</a>. The current libraries are in
|
||||||
</pre>
|
<tt>lib/resource</tt>. Version 0.6 is in
|
||||||
|
<tt>lib/resource-0.6</tt>.
|
||||||
|
|
||||||
<p>
|
</body></html>
|
||||||
|
|
||||||
To appear later at GF Homepage:<p>
|
|
||||||
|
|
||||||
<a href="http://www.cs.chalmers.se/%7Eaarne/GF">
|
|
||||||
<tt>http://www.cs.chalmers.se/~aarne/GF</tt></a>
|
|
||||||
</p></body></html>
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
--# -path=.:../romance:../abstract:../../prelude
|
--# -path=.:../romance:../abstract:../../prelude
|
||||||
|
|
||||||
concrete ResourceFre of ResourceVP = RulesFre, StructuralFre, VerbphraseFre ** {} ;
|
concrete ResourceFre of Resource = RulesFre, ClauseFre, StructuralFre ** {} ;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
lib/resource/italian/ResourceIta.gf
Normal file
4
lib/resource/italian/ResourceIta.gf
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
--# -path=.:../romance:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete ResourceIta of Resource = RulesIta, ClauseIta, StructuralIta ** {} ;
|
||||||
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
--# -path=.:../scandinavian:../abstract:../../prelude
|
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||||
|
|
||||||
---- concrete ResourceSwe of Resource = RulesSwe, VerbphraseSwe ** {} ;
|
|
||||||
concrete ResourceNor of Resource = RulesNor, StructuralNor, ClauseNor ** {} ;
|
concrete ResourceNor of Resource = RulesNor, StructuralNor, ClauseNor ** {} ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
--# -path=.:../romance:../abstract:../../prelude
|
--# -path=.:../romance:../abstract:../../prelude
|
||||||
|
|
||||||
instance ResourceSpa of Resource = reuse AllResourceSpa ;
|
concrete ResourceSpa of Resource = RulesSpa, ClauseSpa, StructuralSpa ** {} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user