[Added beginnings of documentation. bjorn@bringert.net**20041022135116] < > { adddir ./doc addfile ./doc/gf-java.html hunk ./doc/gf-java.html 1 - + + + + +Using GF grammars in Java and OAA + + + + + +

Using GF grammars in Java and OAA

+ +

Björn Bringert, +bringert@cs.chalmers.se +

+ +

Introduction

+ +

GF

+ +

+The Grammatical +Framework (GF) is a grammar formalism well suited to writing +multilingual grammars for natural languages. +

+ +

This system

+ +

+The system presented in +this document implements parsing and linearization using GF grammars. +

+ +

OAA

+ +

+The Open Agent Architecture +(OAA) is "a framework for integrating a community of heterogeneous +software agents in a distributed environment". +

+ +

Requirements

+ +

The GF system is required +for producing the input to this system from GF source grammars. GF is not required to run programs +using this syste, only to produce the grammars for them.

+ +

Java 1.5 is required to compile +and run the system.

+ +

+OAA 2.3.0 or later is required to use +the OAA interfce. +

+ +

OAA interface

+ +

+The OAA agent declares these solvables: +

+ +

parse

+ +

parse(Grammar,Lang,Text,Tree)

+ +

Parameters

+ +
+
Grammar
+
The name of the grammar.
+ +
Lang
+
The name of the concrete syntax that should be used for +parsing. If Lang is not instantiated, the parser +will try all available languages in the given grammar, +and return results for each language that the text can be parsed in.
+ +
Text
+
The text to parse. Must be instantiated.
+ +
Tree
+
The parse tree. Normally not instantiated. +The parse tree from the parser is unified with +this value. Parse trees are represented as ICL structs. +
+
+ +

Examples

+ + + +

linearize

+ +

linearize(Grammar,Lang,Tree,Text)

+ +

Parameters

+ +
+
Grammar
+
The name of the grammar.
+ +
Lang
+
The name of the concrete syntax that should be used for linearization. +If Lang is not instantiated, linearizations for +all available languages in the given grammar will +be returned.
+ + +
Tree
+
The abstract syntax tree to linearize. Must be instantiated.
+ +
Text
+
The linearization of the given tree.
+ +
+ + +

Examples

+ + + + +

translate

+ +

translate(Grammar,FromLang,Input,ToLang,Output)

+ +

Parameters

+ +
+
Grammar
+
The name of the grammar.
+ +
FromLang
+
The name of the concrete syntax that should be used for parsing the input text. +If Lang is not instantiated, all available languages in the given grammar will +be tried.
+ +
Input
+
The input text. Must be instantiated.
+ +
ToLang
+
The name of the concrete syntax that should be used for linearizing the output.
+ +
Output
+
The output text. Normally not instantiated.
+ +
+ + +

Examples

+ + + + + +

Typed abstract syntax trees in Java

+ +

The standard parsing and linearization functions use untyped abstract syntax trees. +There is a facility for generating Java classes which can represent an abstract +syntax using typed trees.

+ + + hunk ./se/chalmers/cs/gf/oaa/Translate.java 15 - private static String solvableString = "translate(Grammar, FromLang,Input,ToLang,Output)"; + private static String solvableString = "translate(Grammar,FromLang,Input,ToLang,Output)"; }