Difference between revisions of "Chunking: A full example"

From Apertium
Jump to navigation Jump to search
(New page: This will be a full example of chunking, which we build from the ground up. We will look at Esperanto <-> English and try to translate the sentence "La libro estas bona" to "The book is g...)
 
Line 1: Line 1:
 
This will be a full example of chunking, which we build from the ground up.
 
This will be a full example of chunking, which we build from the ground up.
   
We will look at Esperanto <-> English and try to translate the sentence "La libro estas bona" to "The book is good".
+
We will look at Esperanto <-> English and try to translate the sentence "La libro estas blua" to "The book is blue".
   
 
First a little overview of how 3-stage transfer normally works:
 
First a little overview of how 3-stage transfer normally works:
* First the individual words are categorized and put into chunks (in the .t1x file).
+
* Transfer stage: Words are translated using the bidix and categorized and put into chunks (in the .t1x file). Here the tags in the words can also be added, removed or made into 'pointers' that points to the tags in the enclosing chunk.
 
* Interchunk stage: Chunks are reordered, combined and split and chunk tags changed (in the .t2x file)
Here the tags in the words can also be added, removed or made into 'pointers' that points to the tags in the enclosing chunk.
 
* Then the chunks are reordered, combined and split (in the .t2x file)
+
* Postchunk stage: The words in the chunks are restored (in the .t3x file)
* Then the chunks thrown are reordered, combined and split (in the .t3x file)
 
   
  +
If we look at how "The book is good" goes throgh the system, we have just before transfer:
+
If we look at how "The blue book is good" goes throgh the system, we have just before transfer:
 
<pre>
 
<pre>
^The<det><def><sp>$ ^book<n><sg>$
+
^The<det><def><sp>$ ^blue<adj>$ ^book<n><sg>$ ^be<vbser><pres><p3><sg>$ ^good<adj><sint>$
^be<vbser><pres><p3><sg>$
 
^good<adj><sint>$
 
 
</pre>
 
</pre>
 
which is chunked into
 
which is chunked into
 
<pre>
 
<pre>
^det_nom<SN><sg><nom>{^La<det><def><2><3>$ ^libro<n><2><3>$}$
+
^det_adj_nom<SN><sg><nom>{^La<det><def><2><3>$ ^blua<adj><2><3>$ ^libro<n><2><3>$}$ ^ser<SV><pres><p3><sg>{^esti<vbser><pres>$}$ ^adj<SN><sg>{^bona<adj><sg><nom>$}$
^ser<SV><pres><p3><sg>{^esti<vbser><pres>$}$
 
^adj<SN><sg>{^bona<adj><sg><nom>$}$
 
</pre>
 
Here 'det_nom' is the name of the chunk and <pre><SN><sg><nom></pre> the chunk's tags. The content is {^La<det><def><2><3>$ ^libro<n><2><3>$} where the <2> and <3> are pointers to the chunk's tag (<sg> and <nom> respectively). This allows us to change the values at chunk level later on, if necessary.
 
 
 
<pre>
 
 
</pre>
 
</pre>
 
Here 'det_adj_nom' is the name of the chunk and <pre><SN><sg><nom></pre> the chunk's tags. The content of the chunk is {^La<det><def><2><3>$ ^blua<adj><2><3>$ ^libro<n><2><3>$} where the <2> and <3> are pointers to the chunk's tag (<sg> and <nom> respectively). This allows us to change the values at chunk level later on, if necessary.
   
  +
In this simple case nothing happens at the interchunk stage. After the postchunk stage it looks like:
 
<pre>
 
<pre>
  +
^La<det><def><sg><nom>$ ^blua<adj><sg><nom>$ ^libro<n><sg><nom>$ ^esti<vbser><pres>$ ^bona<adj><sg><nom>$
 
</pre>
 
</pre>
  +
which becomes "La blua libro estas bona".
   
   

Revision as of 17:59, 28 September 2008

This will be a full example of chunking, which we build from the ground up.

We will look at Esperanto <-> English and try to translate the sentence "La libro estas blua" to "The book is blue".

First a little overview of how 3-stage transfer normally works:

  • Transfer stage: Words are translated using the bidix and categorized and put into chunks (in the .t1x file). Here the tags in the words can also be added, removed or made into 'pointers' that points to the tags in the enclosing chunk.
  • Interchunk stage: Chunks are reordered, combined and split and chunk tags changed (in the .t2x file)
  • Postchunk stage: The words in the chunks are restored (in the .t3x file)


If we look at how "The blue book is good" goes throgh the system, we have just before transfer:

^The<det><def><sp>$ ^blue<adj>$ ^book<n><sg>$ ^be<vbser><pres><p3><sg>$ ^good<adj><sint>$

which is chunked into

^det_adj_nom<SN><sg><nom>{^La<det><def><2><3>$ ^blua<adj><2><3>$ ^libro<n><2><3>$}$ ^ser<SV><pres><p3><sg>{^esti<vbser><pres>$}$ ^adj<SN><sg>{^bona<adj><sg><nom>$}$

Here 'det_adj_nom' is the name of the chunk and

<SN><sg><nom>

the chunk's tags. The content of the chunk is {^La<det><def><2><3>$ ^blua<adj><2><3>$ ^libro<n><2><3>$} where the <2> and <3> are pointers to the chunk's tag (<sg> and <nom> respectively). This allows us to change the values at chunk level later on, if necessary.

In this simple case nothing happens at the interchunk stage. After the postchunk stage it looks like:

^La<det><def><sg><nom>$ ^blua<adj><sg><nom>$ ^libro<n><sg><nom>$ ^esti<vbser><pres>$ ^bona<adj><sg><nom>$

which becomes "La blua libro estas bona".


Word/chunk reordering

Now that "La libro estas bona" -> "The book is good" works, lets look at how chunk reordering works. In Esperanto you make a sentence into a question by putting "Ĉu" in the start of the sentence: "Ĉu la libro estas bona?" In English the verb needs to come first: "Is the book good?".