Living deliverables are the online drafts of the project's deliverable documents. Please use the cover page as in the template deliverable and enter the administrative data for the deliverable. Once finished editing, and ready for the final version, produce the PDF from the top cover page, using the print icon, and create a Biblio item to archive the version of the document to be delivered. Both the Biblio item and the link to the corresponding living deliverable should be entered in the administrative view for the project's deliverables.
Having done the above, the table of deliverables is automatically filled in by the system.
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D2.1. GF Grammar Compiler API |
Security (distribution level): | Public |
Contractual date of delivery: | M13 |
Actual date of delivery: | March 2010 |
Type: | Prototype |
Status & version: | Draft (evolving document) |
Author(s): | A. Ranta, T. Hallgren, et al. |
Task responsible: | UGOT |
Other contributors: |
Abstract
The present paper is the cover of deliverable D2.1 as of M13.
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D2.2 Grammar IDE |
Security (distribution level): | Public |
Contractual date of delivery: | M18 |
Actual date of delivery: | September 2011 |
Type: | Prototype |
Status & version: | Final |
Author(s): | A. Ranta, T. Hallgren, et al. |
Task responsible: | UGOT |
Other contributors: | John Camilleri, Ramona Enache |
Abstract
Deliverable D2.2 describes the functionalities for an Integrated Development Environment (IDE) for GF (Grammatical Framework). The main question it addresses is how should such a system help the programmers who write multilingual grammars? Two IDE's are presented: a web-based IDE enabling a quick start for GF programming in the cloud, and an Eclips plug-in, targeted for expert users working with large projects, which may involve the integration of GF with other components. Example-based grammar writing is also described in the end.
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D4.1 Knowledge Representation Infrastructure |
Security (distribution level): | Public |
Contractual date of delivery: | 1 Nov 2010 |
Actual date of delivery: | 1 Nov 2010 |
Type: | Regular Publication |
Status & version: | Final |
Author(s): | Petar Mitankin, Atanas Ilchev |
Task responsible: | ONTO ( WP4 ) |
Other contributors: | Borislav Popov, Reneta Popova, and Gergana Petkova |
This document presents the specification of the Knowledge Representation Infrastructure (KRI), which is based on pre-existing products. The KRI ensures a mature basis for storage and retrieval of structured knowledge and content. The document provides a description of the technology building blocks, overall architecture, standards used, query languages and inference rules.
Attachment | Size |
---|---|
D4.1_reviewed.pdf | 1.07 MB |
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D6.1. Simple Drill Grammar Library |
Security (distribution level): | Public |
Contractual date of delivery: | M18 |
Actual date of delivery: | September 2011 |
Type: | Prototype |
Status & version: | Final (evolving document) |
Author(s): | J. Saludes, et al. |
Task responsible: | UPC |
Other contributors: |
Abstract
The present paper is the cover of deliverable D6.1 as of WP6. It gives installation instructions for the Mathematical Grammar Library and a short manual.
The living end of the library is publicly available using subversion as:
svn co svn://molto-project.eu/mgl
A stable version can be found at:
svn co svn://molto-project.eu/tags/D6.1
The mgl library consists on the following files and directories:
At the same time, the library can be organized in three layers of increasing complexity:
Inside the mgl directory:
make
will compile the top (Operations) layer and produce Test.pgf. To compile only the OpenMath layer:
make om
An online version of the mathbar demo is http://www.grammaticalframework.org/demos/minibar/mathbar.html.
The library compiles for the following EU languages: Bulgarian, Catalan, English, Finnish, French, German, Italian, Polish, Romanian, Spanish, Swedish.
Regression testing of the OpenMath productions is possible through a treebank containing about 140 productions from this layer. At the present moment it contains linearizations for English, German, Polish and Spanish. At the time of writing this report, the entries of these languages (except for Polish) had been corrected by fluent speakers of the respective language. To allow for discrepancy, earlier corrections are also stored in the treebank, tagged with author and revision number.
The structure of the treebank is described in the evaluating document.
To test the library, make sure you have an up-to-date OpenMath.pgf. You can recreate it by issuing:
make om
and then, on the test directory:
./tbm table
That will make a table indexed by treebank entry and testing language (English, German an Spanish), showing the number of differences between the actual linearization and the corrected one.
Each time a new revision is committed to the repository, the output of this command is saved into test/table. Comparing different revisions of this file allows to measure the progress of the bug-fixing effort.
To review the current defects for language L:
./tbm review -lL
It will walk all the defects showing the differences, the stored corrected concretes, the abstract and the current linearization. For a list of available sub-commands press
.
Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Alba Hierro, Inari Listenmma, Aarne Ranta, Ares Ribo, Adam Slaski, Shafqat Virk and Sebastian Xambó.
Imperative mode forces "!" at the end?
Not what we want for exercises.
Test> l DoComputeF DefineV (Var2Fun f)
define f !
We want to express:
"x gleich y"
or
"x hoch y"
mkAdA : Str → AdA
It doesn't exist
Example
for all z , r , it isn't true that r and if p , then , it isn't true that r
für alle z, r , ist es nicht wahr daß r und wenn p dann ist es nicht wahr daß r
I think it would be better to write "gilt", "gilt nicht" (english "holds", "it does not hold") instead of "es ist nicht wahr", "es ist wahr", "it is true", "it isn't true":
for all z , r , r does not hold and if p , then , r does not hold
für alle z, r , r gilt nicht und wenn p dann r gilt nicht
exist (BaseVarNum x) (Var2Set C) (mkProp (divides (Var2Num y) (Var2Num x)))
map y (factorial (Var2Num x)) (suchthat (Var2Set A) x r)
set (BaseValNum (Var2Num y) (Var2Num z))
l exist (BaseVarNum x) (Var2Set C) (mkProp (divides (Var2Num y) (Var2Num x)))
hay x en C tal que y divida a x
hay→existe
divida → divide
el conjunt amb element únic el cub de pi
DefNPwithbaseElem : CN → MathObj → MathObj =
\cn,o → DefSgNP (mkCN cn (prepAdv with_Prep (mkNP (mkCN (mkCN (mkA "únic") element_CN) o)))) ;
Problema:
No puc escriure "d'element únic" perquè si canvio el with_Prep per un possess_Prep o un part_Prep (of) , omet la preposició! Perquè?
cartesian_product (BaseValSet (Var2Set A) (Var2Set B))
imaginary (Var2Num y)
lcm (BaseValNum (Var2Num y) (Var2Num z))
root2 (real (Var2Num x))
Problem: and_Conj in spanish does not include the case "e", for example for "x e y". It should be
and_Conj = {s1 = [] ; s2 = etConj.s ; n = Pl} ;
For the moment, we have created a new
myAnd_Conj=and_Conj;at MathI.gf and redefined it as
and_Conj = {s1 = [] ; s2 = etConj.s ; n = Pl} ;at MathSpa.gf
This should be fixed at StructuralSpa.gf
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D6.2. Prototype of comanding CAS |
Security (distribution level): | Public |
Contractual date of delivery: | M23 |
Actual date of delivery: | February 2012 |
Type: | Prototype |
Status & version: | Final (evolving document) |
Author(s): | Jordi Saludes, Ares Ribó |
Task responsible: | UPC |
Other contributors: |
The present paper is the cover of deliverable D6.2 as of WP6. It gives description and installation instructions for the executables included in this deliverable.
The following table describes whats is needed in order to use the executables. In all case you'll need GF and Sage.
gfsage
is the simple dialog executable, shell
denotes the component that allow using natural language inside Sage and shell-complete
is the same with auto-completion of commands.
Component | O. S. | Extra requirement | Spoken output | autocompletion |
---|---|---|---|---|
gfsage | Mac OS X, Linux Ubuntu | ghc, curl | OSX1, Linux | yes |
shell | all2 | — | no | |
shell-complete | Linux | gf python bindings | yes |
Depending on your permission settings you might have to run some of these command as sudo
. For all of these first you have to checkout the Mathematics Grammar Library from:
svn co svn://molto-project.eu/mgl
Be warned that develoopment will continue for some time in this HEAD branch. For a frozen version of it, checkout from:
svn co svn://molto-project.eu/tags/D6.2
You'll find detailed instructions for installing each executable in the following pages. For the moment, note that it is necessary to modify some files in your Sage files, for these executables to run. Usually, we have to make these changes just once: The first time, the installation procedure will warn you about it:
Please add 'sage.nlgf' to /usr/local/sage-4.7.2/devel/sage/setup.py
Since ours is not a regular Sage package, we must add a package reference manually by tweaking setup.py
given above (Notice that yours may have a different path). This is a python file that Sage reads to configure the system using the command setup
. Please find it in the file, mine is at line 882 and looks like this:
code = setup(name = 'sage',
The setup command lists several items; Please locate packages (which is a python list) and add 'sage.nlgf'
(quotes included) among the other packages listed there. Python is picky about indentation and doesn't like to have spaces and tabs mixed. Please check that you're using the same spacing as the rest of the file.
The installation has been tested on Sage 4.7.1, 4.7.2 and 4.8
The goal of this work is to develop a command-line tool able to take commands in natural language and have them executed by Sage, a collection of Computer Algebra packages presented in a uniform way. We present here instructions on how to build the interface and examples of its intended use.
You'll need:
cabal
, as in Haskell platformsage
command. It assumes it's in your PATH)You can get this source version by:
cabal install gf
We can install the other dependencies too by:
cabal install json curl
Checkout the mathematics grammar library from:
svn co svn://molto-project.eu/mgl
This is the active branch. For the fixed one use:
svn co svn://molto-project.eu/tags/D6.2
Go into the mgl/sage directory (D6.2/sage if you're using the fixed branch) and make it:
cd mgl/sage
make
The first time you make it will fail, asking you to make modifications in the Sage installation. Please refer to the installation page.
Now try to build gfsage
again. All these build operations will ask Sage to "rebuild" itself. Be warned that the first rebuild takes some time:
make
The system as been tested in Mac (OS X 10.7) and Linux (Ubuntu).
Run the tool as:
./gfsage english
giving the input language as argument. It will take some seconds to start the server. After that it will reply with some server information and will show the prompt:
sage>
You can then enter your query:
sage> compute the product of the octal number 12 and the binary number 100. (3) 40 answer: it is 40 .
To show that a CAS is actually behind the scene, let's try something symbolic:
sage> compute the greatest common divisor of x and the product of x and y. (4) x answer: it is x .
and compare it with:
sage> compute the greatest common divisor of x and the sum of x and y. (5) 1 answer: it is 1 .
Sage does the right thing in both cases, x and y being unbound numeric variables.
sage> compute the second iterated derivative of the cosine at pi. (6) 1 answer: it is 1 .
Exit the session by issuing CRTL+D: This way the server exits cleanly.
Just another example in a different language:
./gfsage spanish Login into localhost at port 9000 Session ID is c1ef10dfd49e4fdb3214fa6d3a3b9c92 waiting... EmptyBlock 2 finished handshake. Session is c1ef10dfd49e4fdb3214fa6d3a3b9c92 sage> calcula la parte imaginaria de la derivada de la exponencial en pi. (4) 0 answer: es 0 .
More recent examples involving integer literals and integration:
sage> compute the sum of 1, 2, 3, 4 and 5. (3) 15 answer: it is 15 . sage> compute the summation of x when x ranges from 1 to 100. (4) 5050 answer: it is 5050 . sage> compute the integral of the cosine from 0 to the quotient of pi and 2. waiting... (5) 1 answer: it is 1 . sage> compute the integral of the function mapping x to the square root of x from 1 to 2. (6) 4/3*sqrt(2) - 2/3 answer: it is 4 over 3 times the square root of 2 minus the quotient of 2 and 3 .
Use english:
gfsage
Use LANGUAGE:
gfsage LANGUAGE
General invocation:
gfsage [OPTIONS]
where OPTIONS are:
short form | long form | description | |
---|---|---|---|
-h |
--help |
Print usage page | |
-i LANGUAGE |
--input-lang=LANGUAGE |
Make queries in LANGUAGE | |
-o LANGUAGE |
--output-lang=LANGUAGE |
Give answers in LANGUAGE | |
-V LEVEL |
--verbose=LEVEL |
Set the verbosity LEVEL | |
-t FILE |
--test=FILE |
Test samples in FILE | |
-v[VOICE] |
--voice[=VOICE] |
Use voice output. To list voices use ? as VOICE. |
|
-F |
--with-feedback |
Restate the query when answering. |
This condition is signaled by the message:
gfsage: Connecting CurlCouldntConnect
I used a Linux virtual machine to reproduce this condition and find that, sometimes, it takes about 10 retries for the server to catch, but then it stays running ok for hours. My guess is that is related to some timeout limit in the server. Killing the orphaned python processes from the previous retries might help too (killall python
).
realsets.py
is a Sage module to support subsets of the real field consisting of intervals and isolated points and was developed to demonstrate set operations of the MGL Set1
module.
It is based of previous work from Interval1Sage adding integration on real sets and real intervals.
An object in this module consists of a list of disjoint open intervals plus a list of isolated points (not belonging to these intervals). Notice that Infinite
is acceptable as interval bound. Therefore, one can define:
Represent a set that can be the union of some intervals and isolated points. It consists of:
A closed interval:
? RealSet.cc_interval(1,4);
[ 1 :: 4 ]
A single point:
? RealSet.singleton(1)
{1}
Union is supported with intervals and can be nested :
? I = RealSet.co_interval(1, 4)
? J = RealSet.co_interval(4, 5)
? M = RealSet.oc_interval(7, 8)
? I.union(J).union(M)
[ 1 :: 5 [ ∪ ] 7 :: 8 ]
? I.intersection(J)
()
? I.intersection(RealSet.cc_interval(2,5))
[ 2 :: 4 [
Is a point in the set?
? I = RealSet.oo_interval(1, 3)
? 2 in I
True
? 3 in I
False
Is a set discrete (i.e: does not contain intervals)?
? RealSet.oo_interval(0,1).discrete
False
? RealSet(points=(1,2,3)).discrete
True
Size of a discrete is the number of points:
? RealSet(points=range(5)).size
5
? RealSet.oo_interval(0,3).size
+Infinity
A is subset of B
? A = RealSet.oo_interval(0,1)
? B = RealSet.cc_interval(0,1)
? RealSet().subset(A)
True
? B.subset(A)
False
? A.subset(B)
True
? A.subset(A)
True
? A.subset(A, proper=True)
False
Return the infimum (greatest lower bound)
? RealSet(points=range(3)).infimum()
0
? RealSet.oo_interval(1,3).infimum()
1
The opposite of a set: –A = {-x | x ∈ A}
? -RealSet.oo_interval(1,2)
] -2 :: -1 [
Return the supremum (least upper bound)
? RealSet(points=range(3)).supremum()
2
? RealSet.oo_interval(1,3).supremum()
3
The complementary of a set:
? RealSet.oo_interval(2,3).complement()
] -Infinity :: 2 ] ∪ [ 3 :: +Infinity [
? RealSet(points=range(3)).complement()
] 0 :: 1 [ ∪ ] 1 :: 2 [ ∪ ] 2 :: +Infinity [ ∪ ] -Infinity :: 0 [
The set difference of A
and B
: \{x \in A, x\notin B\}
? I = RealSet.oo_interval(2,+Infinity)
? J = RealSet.oo_interval(-Infinity, 5)
? I.setdiff(J)
[ 5 :: +Infinity [
? J.setdiff(I)
] -Infinity :: 2 ]
gfsage
is a prototype to demonstrate two-way natural language communication between a user and a Sage system.
When you invoke the gfsage
command interactively:
The details of these components are given below.
A GF module acts as a post office translating messages between the different parties (nodes) composing a dialog. This section is more a description of a proposed design strategy for a generic postoffice interface based on GF. The actual code implements ideas of this design, but, for instance, it contains no edges or nodes as explicit entities.
gfsage
deals with just 2 agents:
in the case whether the input language is different of the output language, we may consider a third node (the output user).
There is a unique pgf
module containing all GF information for the dialog system to work: Commands.pgf
. Each node has a language (a GF concrete module) assigned: the user uses a natural language (i.e., ComandsEng
for English).
A node reacts to received messages by sending a reply. The chain of messages between two nodes is called a dialog. An active node as the user can start a dialog by sending a message. A passive node, like the Sage system here, just replies to the received messages.
A node can receive:
no_parse
message from the postoffice telling that a previous outgoing message cannot be parsed.is_ambiguous
message from the postoffice related to a previous message sent by the node, specifying that it was ambiguous and carrying additional info for the node to decide among the possible meanings. To respond to this, the node must send a disambiguate
message to the postoffice (see below).A node can send:
disambiguate
message sent in response to an ambiguous message. In this message the node chooses one of the options or aborts the transaction.A regular message between two given nodes corresponds to a fixed GF category. In the case of gfsage
it is Command
for messages traveling from User to Sage and Answer
for messages going the other way.
A regular message from node N1 to node N2 goes through the following steps:
no_parse
message is sent back to the sending node. If it contains more than one entry, an is_ambiguous
message is sent. In the previous cases, the process stops here; Only when the computed set contains just an entry, is this pushed downstream to the node N2.For Sage to work alongside GF, we need a http sever listening to Sage commands and some scripts to set up the environment and respond to the type of queries that can be expressed in the Mathematics Grammar Library, MGL.
A Sage process is started in the background by the start-nb.py
script in -python
mode. This script starts a Sage notebook, as described in Simple server API, listening on port 9000 and up to requests in http format. It also installs a handler for cleanly disposing of the notebook object whenever the parent process terminates.
The parent process sends then an initial request to load some functions and variables that we'll need in the dialog system defined in prelude.sage
and goes into the main evaluation loop.
realsets.py
Set1
module of the MGL. (See the page about it)prelude.sage
OS X has voice output buit-in, usable from the shell by way of the say
command. You can use several voices in English or download more for other languages.
mgl/sage
as described previously.gfsage Use english gfsage LANGUAGE Use this language gfsage [OPTIONS] where OPTIONS are: -h --help print this page -i INPUT --input-lang=INPUT Make queries in LANGUAGE -o OUTPUT --output-lang=OUTPUT Give answers in LANGUAGE -v[VOICE] --voice[=VOICE] use voice output. To list voices use ? as VOICE. -F --with-feedback Restate the query when answering.
The options relevant here are -v
and -F
. Use the first to select voice output. With no argument it will pick the first available voice for the OUTPUT voice selected:
./gfsage -i english -v
Voiced by Agnes
... It will use Agnes as English voice. Notice that if you do not give a -o
option, the OUTPUT language is assume to be the same as the INPUT language.
To list the available voices use:
./gfsage -i english -v?
Agnes, Albert, Alex, Bahh, Bells, Boing, Bruce, Bubbles, Cellos, Daniel, Deranged, Fred, Hysterical, Junior, Kathy, Princess, Ralph, Trinoids, Vicki, Victoria, Whisper, Zarvox
It will list the English voices. To use a specific voice write:
./gfsage -i german -vYannick
Voiced by Yannick
The option -F
is to make the system paraphrase your query on answering. First, get a simple answer:
./gfsage -i english
Login into localhost at port 9000
Session ID is df7ad7c769f2faac68b6bb9489bb97e2
waiting... EmptyBlock 3
sage> compute the factorial of 5.
(4) 120
answer: it is 120 .
... and now the same with paraphrasing:
./gfsage -i english -F
Login into localhost at port 9000
Session ID is 88549994a28940fe0657eb9e506a5e84
waiting... EmptyBlock 3
sage> compute the factorial of 5.
(4) 120
answer: the factorial of 5 is 120 .
So, to experience voice output in its full glory you have to use both -v
and -F
.
To help with regression testing I recently added a test option to gfsage for batch-testing the system by reading dialog samples from a file.
The samples must be in a text file and consist in a sequence of dialogs which are sequences of query/responses to the Sage system. Notice that a dialog might carry a state in the form of assumptions that are asserted or variables that are assigned. In the same way, each dialog is completely independent of the others.
Each dialog starts with a BEGIN
or BEGIN language
line. It specifies the beginning of dialog triplets and the natural language for these triplets. The dialog runs until an END
line. The language specified becomes the current language. Dialogs with no given languages are assumed to be in the current language. At the start of a testing suite, the current language is English.
A triplet is a sequence of 3 lines:
BEGIN spanish calcula el factorial del número octal 11.
362880 es 36280 . END BEGIN english let x be 4 .
compute the sum of x and 5 . 9 it is 9 . compute the sum of it and 5 . 14 it is 14 . END
Notice that blank lines are relevant: they mark that Sage responded nothing to the query. Therefore, it is not allowed to insert blank lines neither between triplets nor dialogs.
gfsage --test
will test the dialogs in and tell about the differences. You got a summary of the results:
Dialog 'compute Gamma....' failed 18 out of 19 dialogs successful.
By defining new Sage interfaces we can command the Sage shell and notebook server using natural language.
Move to the sage directory and build sage-shell:
cd mgl/sage
make sage-shell
The first time you build it, you may run into a warning as in the installation section of the front page, or:
Please add nlgf components to the interfaces list in /usr/local/sage-4.7.2/devel/sage/sage/interfaces/all.py
We must inform Sage that there are some new interfaces for it: We open interfaces/all.py
(Notice that your actual path might be different), go to the end of the file and add something like this:
from nlgf import english, spanish
interfaces.extend(['english', 'spanish'])
The first line asks the system to load the interfaces for commanding Sage using English and Spanish. The next line add these to the list of available interfaces.
Now retry building:
make sage-shell
At the time of writing, the module nlgf
provides catalan
, english
, german
, and spanish
interfaces.
In some systems you can have the commands Sage shell auto-completed by pressing the tab key. This is experimental and you have to make the installation completely by hand.
First you have to build the Python bindings for GF which, for the moment, only work in Linux. You'll find there a shared library called gf.so
. Copy or move it into one of the directories that Python scans when resolving imports. Note that it may be the case that the Python instance run by Sage be different of the one your machine runs by default; To be sure, do as follows:
sage -python -c 'import sys; print sys.path'
it will list all the directories that Sage/python scans.
You'll know it's all right when:
sage -python -c 'import gf'
exits with no complain: The next time you enter into the Sage shell you'll have autocompletion for the GF interfaces.
Start a Sage shell:
sage
and switch to one of the defined natural language interfaces:
sage: %english
will reply with:
--> Switching to Gf <--
If you didn't install autocompletion (which is the usual case, auto-completion being experimental), a warning will appear:
No autocompletion available
Now you're ready to issue sage commands in English:
english: compute the summation of x when x ranges from 1 to 100.
5050
english: add 3 to it.
5053
english: let x be the factorial of 6.
720
english: let y be the factorial of 5.
120
english: compute the greatest common divisor of x and y.
120
english: compute the least common multiple of x and y.
720
Go back to the standard interface by typing ctrl+D or typing quit
.
Sage has a notebook interface that gives a more flexible way to interact with it. To use it, start the shell as above and then:
sage: notebook(secure=true, interface='')
The notebook files are stored in: sage_notebook.sagenb
****************************************************
* *
* Open your web browser to https://localhost:8000 *
* *
****************************************************
There is an admin account. If you do not remember the password,
quit the notebook and type notebook(reset=True).
2012-02-13 12:48:19+0100 [-] Log opened.
...
In some systems a browser will open simultaneously. Now you can use Sage from the browser.
Click on New Worksheet. You'll be asked to rename the worksheet (this is optional). A single cell will be ready for your input. Write your command and press evaluate. Notice that a cell can contain more than one command, separated by newlines.
Start a new cell by writing:
%english
and add one or more new lines with commands in English.
Attachment | Size |
---|---|
sage-notebook.jpg | 95.69 KB |
Contract No.: | FP7-ICT-247914 |
---|---|
Project full title: | MOLTO - Multilingual Online Translation |
Deliverable: | D10.2 MOLTO web service, first version |
Security (distribution level): | Public |
Contractual date of delivery: | M3 |
Actual date of delivery: | 2 June 2010 |
Type: | Prototype |
Status & version: | Final |
Author(s): | Krasimir Angelov, Olga Caprotti, Ramona Enache, Thomas Hallgren, Inari Listenmaa, Aarne Ranta, Jordi Saludes, Adam Slaski |
Task responsible: | UGOT |
Other contributors: | UPC, UHEL |
This phrasebook is a program for translating touristic phrases between 14 European languages included in the MOLTO project (Multilingual On-Line Translation): Bulgarian, Catalan, Danish, Dutch, English, Finnish, French, German, Italian, Norwegian, Polish, Romanian, Spanish, Swedish. A Russian version is not yet finished but will be added later. Also other languages may be added.
The phrasebook is implemented by using the GF programming language (Grammatical Framework). It is the first demo for the MOLTO project, released in the third month (by June 2010). The first version is a very small system, but it will extended in the course of the project.
The phrasebook is available as open-source software, licensed under GNU LGPL, at http://code.haskell.org/gf/examples/phrasebook/.
</br/></p/>
The MOLTO phrasebook is a program for translating touristic phrases between 14 European languages included in the MOLTO project (Multilingual On-Line Translation):
The phrasebook is implemented in the GF programming language (Grammatical Framework). It is the first demo for the MOLTO project, released in the third month (by June 2010). The first version is a very small system, but it will be extended in the course of the project.
The phrasebook has the following requirement specification: - high quality: reliable translations to express yourself in any of the languages - translation between all pairs of languages - runnable in web browsers - runnable on mobile phones (via web browser; Android stand-alone forthcoming) - easily extensible by new words (forthcoming: semi-automatic extensions by users)
The phrasebook is available as open-source software, licensed under GNU LGPL. The source code resides in ftp://code.haskell.org/gf/examples/phrasebook/
We consider both the end-user perspective and the content producer perspective.
The phrasebook is available as open-source software, licensed under GNU LGPL. The source code resides in http://code.haskell.org/gf/examples/phrasebook/. Below a short description of the source files.
Sentences
: general syntactic structures implementable in a uniform way. Concrete syntax via the functor SencencesI
.Words
: words and predicates, typically language-dependent. Separate concrete syntaxes.Greetings
: idiomatic phrases, string-based. Separate concrete syntaxes.Phrasebook
: the top module putting everything together. Separate concrete syntaxes.DisambPhrasebook
: disambiguation grammars generating feedback phrases if the input language is ambiguous.Numeral
: resource grammar module directly inherited from the library.The module structure image is produced in GF by
> i -retain DisambPhrasebookEng.gf > dg -only=Phrasebook*,Sentences*,Words*,Greetings*,Numeral,NumeralEng,DisambPhrasebookEng > ! dot -Tpng _gfdepgraph.dot > pgraph.png
The abstract syntax defines the ontology behind the phrasebook. Some explanations can be found in the
ontology document, which is produced from the abstract syntax files
Sentences.gf
and
Words.gf
by make doc
.
Based on this case study, we roughly estimated the effort used in constructing the necessary sources for each new language and compiled the following summarizing chart.
Language | Language skills | GF skills | Informed development | Informed testing | Impact of external tools | RGL Changes | Overall effort |
---|---|---|---|---|---|---|---|
Bulgarian | ### | ### | - | - | ? | # | ## |
Catalan | ### | ### | - | - | ? | # | # |
Danish | - | ### | + | + | ## | # | ## |
Dutch | - | ### | + | + | ## | # | ## |
English | ## | ### | - | + | - | - | # |
Finnish | ### | ### | - | - | ? | # | ## |
French | ## | ### | - | + | ? | # | # |
German | # | ### | + | + | ## | ## | ### |
Italian | ### | # | - | - | ? | ## | ## |
Norwegian | # | ### | + | - | ## | # | ## |
Polish | ### | ### | + | + | # | # | ## |
Romanian | ### | ### | - | - | # | ### | ### |
Spanish | ## | # | - | - | ? | - | ## |
Swedish | ## | ### | - | + | ? | - | ## |
Legend
Language skills
GF skills
Informed Development/Informed testing
Impact of external tools
RGL changes (resource grammars library)
Overall effort (including extra work on resource grammars)
The figure presents the process of creating a Phrasebook using an example-based approach for a language X, in our case either Danish, Dutch, German, Norwegian, for which we had to employ informed development and testing by a native speaker, different from the grammarian.
Remarks : The arrows represent the main steps of the process, whereas the circles represent the initial and final results after each step of the process. Red arrows represent manual work and green arrows represent automated actions. Dotted arrows represent optional steps. For every step, the estimated time is given. This is variable and greatly influenced by the features of the target language and the semantic complexity of the phrases and would only hold for the Phrasebook grammar.
Initial resources :
The first step assumes an analysis of the resource grammar and extracts the information needed by the functions that build new lexical entries. A model is built so that the proper forms of the word can be rendered, and additional information, such as gender, can be inferred. The script applies these rules to each entry that we want to translate into the target language, and one obtains a set of constructions.
The generated constructions are given to an external translator tool (Google translate) or to a native speaker for translation. One needs the configuration file even if the translator is human, because formal knowledge of grammar is not assumed.
The translations into the target language are further more processed in order to build the linearizations of the categories first, decoding the information received. Furthermore, having the words in the lexicon, one can parse the translations of functions with the GF parser and generalize from that.
The resulting grammar is tested with the aid of the testing script that generates constructions covering all the functions and categories from the grammar, along with some other constructions that proved to be problematic in some language. A native speaker evaluates the results and if corrections are needed, the algorithm runs again with the new examples. Depending on the language skills of the grammar writer, the changes can be made directly into the GF files, and the correct examples given by the native informant are just kept for validating the results. The algorithm is repeated as long as corrections are needed.
The time needed for preparing the configuration files for a grammar will not be needed in the future, since the files are reusable for other applications. The time for the second step can be saved if automatic tools, like Google translate are used. This is only possible in languages with a simpler morphology and syntax, and with large corpora available. Good results were obtained for German and Dutch with Google translate, but for languages like Romanian or Polish, which are both complex and lack enough resources, the results are discouraging.
If the statistical oracle works well, the only step where the presence of a human translator is needed is the evaluation and feedback step. An average of 4 hours per round and 2 rounds were needed in average for the languages for which we performed the experiment. It is possible that more effort is needed for more complex languages.
Further work will be done in building a more comprehensive tool for testing and evaluating the grammars, and also the impact of external tools for machine translation from English to various target languages will be analysed, so that the process could be automated to a higher degree for the future work on grammars.
Words
by hand or (semi)automatically for items related to the categories of food, places, and actions will result in immediate increase of the expressiveness of the phrasebook.The basic things "everyone" can do are:
Words
and greetings in Greetings
The missing concrete syntax entries are added to the Words
L.gf
files for each language L. The morphological paradigms of the GF resource library should be used. Actions (prefixed with A
, as AWant
) are a little more demanding, since they also require syntax constructors. Greetings (prefixed
with G
) are pure strings.
Some explanations can be found in the implementation document, which is produced from the concrete syntax files SentencesI.gf
and
WordsEng.gf
by make doc
.
Here are the steps to follow for contributors:
darcs pull
.make present
in gf/lib/src/
.gf/examples/phrasebook/
.make pgf
.darcs record .
(in the phrasebook
subdirectory).darcs send -o my_phrasebook_patch
, which you can send to GF maintainers.gf/src/server/
and follow the instructions in the
project Wiki.
b. Make sure that Phrasebook.pgf
is available to you GF server (see project wiki).
c. Launch lighttpd
(see project wiki).
d. How you can open gf/examples/phrasebook/www/phrasebook.html
and use your phrasebook!Finally, a few good practice recommendations:
The grammarian need not be a native speaker of the language. For many languages, the grammarian need not even know the language, native informants are enough. However, evaluation by native speakers is necessary.
Correct and idiomatic translations are possible.
A typical development time was 2-3 person working days per language.
Google translate helps in bootstrapping grammars, but must be checked. In particular, we found it unreliable for morphologically rich languages.
Resource grammars should give some more support e.g. higher-level access to constructions like negative expressions and large-scale morphological lexica.
Acknowledgments
The user interface is kept slim so as to also be usable from portable devices, e.g. mobile phones. These are the buttons and their functionality:
The symbol &+
means binding of two words. It will disappear in the complete translation.
The translator is slightly overgenerating, which means you can build some semantically strange phrases. Before reporting them as bugs, ask yourself: could this be correct in some situation? is the translation valid in that situation?