1
0
forked from GitHub/gf-rgl

unlexer concat

This commit is contained in:
aarne
2005-02-08 15:35:58 +00:00
parent fcd02b27a7
commit 2ee3d891bc
13 changed files with 145 additions and 12 deletions

View File

@@ -22,6 +22,7 @@ resource Predef = {
oper occur : Tok -> Tok -> PBool = variants {} ; -- test if occurs as substring oper occur : Tok -> Tok -> PBool = variants {} ; -- test if occurs as substring
oper show : (P : Type) -> P -> Tok = variants {} ; -- convert param to string oper show : (P : Type) -> P -> Tok = variants {} ; -- convert param to string
oper read : (P : Type) -> Tok -> P = variants {} ; -- convert string to param oper read : (P : Type) -> Tok -> P = variants {} ; -- convert string to param
oper toStr : (P : Type) -> P -> Str = variants {} ; -- find the "first" string
} ; } ;

View File

@@ -1,3 +1,5 @@
--# -path=.:../../prelude
abstract Lang = abstract Lang =
Rules, Rules,
Clause, Clause,

View File

@@ -1 +1 @@
interface Resource = reuse AllResource ; abstract Resource = Rules, Clause, Structural ** {} ;

View File

@@ -83,7 +83,10 @@ oper
mkVoice : Voice -> Str -> Str = \v,s -> case v of { mkVoice : Voice -> Str -> Str = \v,s -> case v of {
Act => s ; Act => s ;
Pass => s + "s" Pass => s + case last s of {
"s" => "es" ;
_ => "s"
}
} ; } ;
vHusk : Str -> Verbum = \husk -> vHusk : Str -> Verbum = \husk ->

View File

@@ -1,4 +1,4 @@
all: gfdoc htmls all: gfdoc htmls gifs
htmls: htmls:
htmls gf-resource.html htmls gf-resource.html
@@ -14,3 +14,18 @@ gfdoc:
gfdoc ../swedish/ParadigmsSwe.gf ; mv ../swedish/ParadigmsSwe.html . gfdoc ../swedish/ParadigmsSwe.gf ; mv ../swedish/ParadigmsSwe.html .
gfdoc ../swedish/BasicSwe.gf ; mv ../swedish/BasicSwe.html . gfdoc ../swedish/BasicSwe.gf ; mv ../swedish/BasicSwe.html .
gfdoc ../english/ParadigmsEng.gf ; mv ../english/ParadigmsEng.html . gfdoc ../english/ParadigmsEng.gf ; mv ../english/ParadigmsEng.html .
gfdoc ../english/VerbsEng.gf ; mv ../english/VerbsEng.html .
gifs: lang scand low
lang:
echo "pm -printer=graph | wf Lang.dot" | gf ../abstract/Lang.gf
dot -Tgif Lang.dot>Lang.gif
low:
echo "pm -printer=graph | wf Low.dot" | gf ../english/RulesEng.gf
dot -Tgif Low.dot >Low.gif
scand:
echo "pm -printer=graph | wf Scand.dot" | gf ../swedish/RulesSwe.gf
dot -Tgif Scand.dot >Scand.gif

View File

@@ -36,6 +36,35 @@ All morphological paradigms
Basic lexicon of structural, common, and irregular words Basic lexicon of structural, common, and irregular words
<!-- NEW -->
<h2>Success criteria</h2>
Grammatical correctness
<p>
Semantic coverage
<p>
Usability as library for non-linguists
<!-- NEW -->
<h2>These are not success criteria</h2>
Language coverage
<p>
Semantic correctness
<pre>
colourless green ideas sleep furiously
the time is seventy past forty-two
</pre>
<!-- NEW --> <!-- NEW -->
<h2>Languages</h2> <h2>Languages</h2>
@@ -110,6 +139,10 @@ Language-dependent resources
<p> <p>
<a href="VerbsEng.html">English verbs</a>
<p>
<a href="ParadigmsSwe.html">Swedish</a> <a href="ParadigmsSwe.html">Swedish</a>
<p> <p>
@@ -119,19 +152,97 @@ Language-dependent resources
<!-- NEW --> <!-- NEW -->
<h2>Using it</h2> <h2>Use as top-level grammar</h2>
Random generation, translation, morphological analysis...
<p>
Language learning: translation and morpho quiz
<p>
Generate elementary text books from abstract syntax?
<!-- NEW -->
<h2>Use as library</h2>
Import directly by <tt>open</tt>:
<pre>
concrete AppNor of App = open LangNor, ParadigmsNor in {...}
</pre>
No more dummy <tt>reuse</tt> modules and bulky <tt>.gfr</tt> files!
<p>
If you need to convert resource category records to/from strings, use
<pre>
Predef.toStr : L -> Str ;
Predef.fromStr : Str -> L ;
</pre>
<tt>L</tt> must be a linearization type.
<!-- NEW -->
<h2>Use as library through parser</h2>
Use the parser when developing a resource.
<pre>
> p -cat=S -v "jag ska åka till Chalmers"
unknown tokens [TS "åka",TS "Chalmers"]
> p -cat=S "jag ska gå till Danmark"
UseCl (PosTP TFuture ASimul)
(AdvCl (SPredV i_NP go_V)
(AdvPP (PrepNP to_Prep (UsePN (PNCountry Denmark)))))
</pre>
Extend vocabulary at need.
<pre>
åka_V = lexV "åker" ;
Chalmers = regPN "Chalmers" neutrum ;
</pre>
<!-- NEW --> <!-- NEW -->
<h2>Implementatin details: the structure of low-level files</h2> <h2>Implementatin details: the structure of low-level files</h2>
<center>
<img src="Low.gif">
</center>
<!-- NEW --> <!-- NEW -->
<h2>The use of parametric modules</h2> <h2>The use of parametric modules</h2>
In two language families:
<ul>
<li> Romance: French, Italian, Spanish
<li> Scandinavian: Danish, Norwegian, Swedish
</ul>
<center>
<img src="Scand.gif">
</center>
<!-- NEW --> <!-- NEW -->
<h2>Current status</h2> <h2>Current status</h2>
<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>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>Finnish</td> <td>X</td> <td> </td> <td></td> <td></td> <td></tr>
<tr><td>French</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>*</td> <td>*</td> <td></td> <td>*</tr>
<tr><td>Norwegian</td> <td> </td> <td>X</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>*</td> <td></td> <td></td> <td>*</tr>
<tr><td>Swedish</td> <td>X</td> <td>X</td> <td>X</td> <td>X</td> <td>*</tr>
</table>
<!-- NEW --> <!-- NEW -->
<h2>Obtaining it</h2> <h2>Obtaining it</h2>

View File

@@ -218,7 +218,7 @@ lin
add_V3 = dirV3 (regV "add") "to" ; add_V3 = dirV3 (regV "add") "to" ;
number_N = regN "number" ; number_N = regN "number" ;
put_V2 = mkV2 (irregDuplV "put" "put" "put") [] ; put_V2 = mkV2 (irregDuplV "put" "put" "put") [] ;
stop_V = regV "stop" ; stop_V = regDuplV "stop" ;
jump_V = regV "jump" ; jump_V = regV "jump" ;
here_Adv = mkAdv "here" ; here_Adv = mkAdv "here" ;
here7to_Adv = mkAdv "here" ; here7to_Adv = mkAdv "here" ;

View File

@@ -1,4 +1,4 @@
concrete CountryEng of Country = open ResourceEng, ParadigmsEng in { concrete CountryEng of Country = open CategoriesEng, ParadigmsEng in {
lincat lincat
Country = PN ; Country = PN ;

View File

@@ -8,7 +8,7 @@ concrete LangEng of Lang =
TimeEng, TimeEng,
CountryEng CountryEng
** open Prelude, ResourceEng, ParadigmsEng in { ** open Prelude, ParadigmsEng in {
lin lin
AdvDate d = prefixSS "on" d ; AdvDate d = prefixSS "on" d ;

View File

@@ -26,8 +26,8 @@
-- --
-- The following modules are presupposed: -- The following modules are presupposed:
resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in { resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ---- ResourceEng in {
CategoriesEng, RulesEng in {
--2 Parameters --2 Parameters
-- --
-- To abstract over gender names, we define the following identifiers. -- To abstract over gender names, we define the following identifiers.

View File

@@ -1,5 +1,5 @@
concrete TimeEng of Time = NumeralsEng ** concrete TimeEng of Time = NumeralsEng **
open Prelude, ResourceEng, ParadigmsEng in { open Prelude, CategoriesEng, ParadigmsEng in {
lincat lincat
Date = SS ; Date = SS ;

View File

@@ -91,7 +91,7 @@ oper
mkVoice : Voice -> Str -> Str = \v,s -> case v of { mkVoice : Voice -> Str -> Str = \v,s -> case v of {
Act => s ; Act => s ;
Pass => s + case last s of { Pass => s + case last s of {
"t" => "es" ; "s" => "es" ;
_ => "s" _ => "s"
} }
} ; } ;

View File

@@ -1,3 +1,4 @@
--# -path=.:../abstract:../../prelude --# -path=.:../abstract:../../prelude
instance ResourceSwe of Resource = reuse AllResourceSwe ; concrete ResourceSwe of Resource = RulesSwe, StructuralSwe, ClauseSwe ** {} ;