|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
This package contains transformation programs for the Codeco notation. These programs are not written in Java but in SWI Prolog. Among other output formats, Java code can automatically be generated. This package consists of the following programs:
Below, the Codeco notation is briefly described and it is shown how the different transformation programs can be run.The doctoral thesis "Controlled English for Knowledge Representation" describes the Codeco notation in detail.
Simple grammar rules in Codeco look almost the same as common Prolog DCG rules. The only
difference is that the operator "=>
" is used instead of "-->
":
Terminal categories are represented in square brackets.vp => v, np. v => ['does not'], verb.
Complex grammar rules in Codeco are different from common Prolog DCG rules in the sense that they are using features rather than arguments with fixed positions. Arguments are not recognized by their position but by their name:
Every feature has the formvp(num:Num,neg:Neg) => v(num:Num,neg:Neg,type:tr), np(case:acc). v(neg:plus,type:Type) => [does, not], verb(type:Type).
Name:Value
where Name
has to be an atom and
Value
can be a variable or an atom (but not a compound term).
Codeco has special support for pre-terminal categories. Such categories are marked with the dollar sign "$" and can expand only to terminal categories:
np => [a], $noun(text:Noun). $noun(text:country) => [country].
Codeco also provides special support for anaphoric references. Anaphoric references are used in (controlled) natural languages to refer to objects earlier in the sentence. For example, in the sentence
A country contains an area that is not controlled by the country.the anaphoric reference "the country" refers to the antecedent "a country". In Codeco, anaphoric references are defined by the special categories "
>
" and "<
".
">
" marks a position in the text to which anaphoric references can refer (such
positions are called "antecedents"). "<
" refers back to the closed possible
antecedent. An example is shown here:
Furthermore, the special category "np => [a], $noun(text:Noun), >(type:noun, noun:Noun). ref => [the], $noun(text:Noun), <(type:noun, noun:Noun).
/<
" can be used to ensure that there is no
matching antecedent. This can be used, for example, for variables to ensure that no variable is
introduced twice:
The back-referring categories "np => $var(text:Var), /<(type:var, var:V), >(type:var, var:V).
<
" and "/<
" have to immediately follow
a terminal or pre-terminal category.
Codeco has some more features, which are explained in the publication mentioned above.
Note that the SWI Prolog command might be different on your machine (e.g. "swipl -s generate_java.pl -g "generate_java('my_codeco_grammar.pl', 'my.package.MyGrammarClass')" -t halt
plcon
"
or "pl
"). The Prolog DCG file can be generated like this:
swipl -s generate_dcg.pl -g "generate_dcg('my_codeco_grammar.pl', 'my_dcg_grammar.pl')" -t halt
Furthermore, this package provides the programs "generate_html.pl" and "generate_latex.pl", which can be used to generate HTML and LaTeX representations of Codeco grammars. These programs are used as follows:
swipl -s generate_html.pl -g "generate_html('my_codeco_grammar.pl', 'my_html_file.html')" -t halt swipl -s generate_latex.pl -g "generate_latex('my_codeco_grammar.pl', 'my_latex_file.tex')" -t halt
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |