mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
118 lines
4.3 KiB
HTML
118 lines
4.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
|
|
<TITLE>Using the GF resource grammar library in multilingual grammars: an example</TITLE>
|
|
</HEAD><BODY BGCOLOR="white" TEXT="black">
|
|
<P ALIGN="center"><CENTER><H1>Using the GF resource grammar library in multilingual grammars: an example</H1>
|
|
<FONT SIZE="4">
|
|
<I>Author: Aarne Ranta <aarne (at) cs.chalmers.se></I><BR>
|
|
Last update: Fri Dec 16 14:30:57 2005
|
|
</FONT></CENTER>
|
|
|
|
<P></P>
|
|
<HR NOSHADE SIZE=1>
|
|
<P></P>
|
|
<UL>
|
|
<LI><A HREF="#toc1">Quick try</A>
|
|
<LI><A HREF="#toc2">Structure</A>
|
|
<LI><A HREF="#toc3">Resource library version</A>
|
|
</UL>
|
|
|
|
<P></P>
|
|
<HR NOSHADE SIZE=1>
|
|
<P></P>
|
|
<P>
|
|
This document describes the contents of the directory
|
|
<A HREF="http://www.cs.chalmers.se/~aarne/GF/examples/mp3/"><CODE>GF/examples/mp3</CODE></A>.
|
|
</P>
|
|
<P>
|
|
This directory contains a small example of a dialogue system
|
|
grammar built by using the GF resource grammar library. Its sole
|
|
purpose is to demonstrate this usage, i.e.
|
|
</P>
|
|
<UL>
|
|
<LI>how the resource API is used to define concrete syntax
|
|
<P></P>
|
|
<LI>how to divide the grammar into modules
|
|
</UL>
|
|
|
|
<P>
|
|
Thus it is not intended to be (even a part of) a really useful
|
|
system.
|
|
</P>
|
|
<A NAME="toc1"></A>
|
|
<H2>Quick try</H2>
|
|
<P>
|
|
To try out the grammar, do for example
|
|
</P>
|
|
<PRE>
|
|
gf mk3.gfcm -- start GF
|
|
|
|
> gr | l -multi -- random generate
|
|
|
|
> p -tr "which song is played ?" | l -multi -- parse and translate
|
|
|
|
> gt -tr | l -lang=MP3Swe -- generate Swedish "treebank"
|
|
|
|
> si -tr | p | l -multi -- translate speech input
|
|
[say:] I want to play Yesterday
|
|
</PRE>
|
|
<P>
|
|
The last command only works if you have installed
|
|
<A HREF="http://mi.eng.cam.ac.uk/~sjy/software.htm">ATK</A> and compiled
|
|
<A HREF="http://www.cs.chalmers.se/Cs/Research/Language-technology/darcs/GF/doc/darcs.html">GF version 14/12/2005</A>
|
|
or later.
|
|
</P>
|
|
<A NAME="toc2"></A>
|
|
<H2>Structure</H2>
|
|
<P>
|
|
The directory consists of the following grammars:
|
|
</P>
|
|
<UL>
|
|
<LI><A HREF="MP3.gf"><CODE>MP3.gf</CODE></A> the main abstract syntax
|
|
<LI><A HREF="MP3I.gf"><CODE>MP3I.gf</CODE></A> functor implementation of the main abstract
|
|
<LI><A HREF="MP3Eng.gf"><CODE>MP3Eng.gf</CODE></A> English instantiation of the functor
|
|
<LI><A HREF="MP3Fin.gf"><CODE>MP3Fin.gf</CODE></A> Finnish instantiation of the functor (buggy)
|
|
<LI><A HREF="MP3Fre.gf"><CODE>MP3Fre.gf</CODE></A> French instantiation of the functor
|
|
<LI><A HREF="MP3Ger.gf"><CODE>MP3Ger.gf</CODE></A> German instantiation of the functor
|
|
<LI><A HREF="MP3Swe.gf"><CODE>MP3Swe.gf</CODE></A> Swedish instantiation of the functor
|
|
<LI><A HREF="Lexicon.gf"><CODE>Lexicon.gf</CODE></A> the interface on which <CODE>MP3I.gf</CODE> depends
|
|
<LI><A HREF="LexiconEng.gf"><CODE>LexiconEng.gf</CODE></A> English instance of the interface
|
|
<LI><A HREF="LexiconFin.gf"><CODE>LexiconFin.gf</CODE></A> Finnish instance of the interface
|
|
<LI><A HREF="LexiconFre.gf"><CODE>LexiconFre.gf</CODE></A> French instance of the interface
|
|
<LI><A HREF="LexiconGer.gf"><CODE>LexiconGer.gf</CODE></A> German instance of the interface
|
|
<LI><A HREF="LexiconSwe.gf"><CODE>LexiconSwe.gf</CODE></A> Swedish instance of the interface
|
|
</UL>
|
|
|
|
<P>
|
|
The main linguistic content is in the functor <CODE>MP3I</CODE> and the
|
|
instances of the <CODE>Lexicon</CODE> interface.
|
|
</P>
|
|
<P>
|
|
The way in which the implementation is divided to a functor
|
|
and an interface depending on it should work as a model for
|
|
building resource grammar applications in general.
|
|
</P>
|
|
<P>
|
|
In order to compile the grammars from source, you must set the
|
|
environment variable <CODE>GF_LIB_PATH</CODE> to point at the root
|
|
of your GF library, e.g. in the bash shell,
|
|
</P>
|
|
<PRE>
|
|
export GF_LIB_PATH=/usr/local/lib/GF/
|
|
</PRE>
|
|
<P></P>
|
|
<A NAME="toc3"></A>
|
|
<H2>Resource library version</H2>
|
|
<P>
|
|
The example builds on resource v. 0.6. The reason for not building
|
|
on a later version is that German is not yet implemented for them.
|
|
The example will probably be migrated to v. 1.0 soon. The new resource
|
|
version will fix the bugs in the Finnish implementation.
|
|
</P>
|
|
|
|
<!-- html code generated by txt2tags 2.0 (http://txt2tags.sf.net) -->
|
|
<!-- cmdline: txt2tags -\-toc mp3-resource.txt -->
|
|
</BODY></HTML>
|