User:Khannatanmai/Wordbound blanks

From Apertium
Jump to navigation Jump to search

This page will follow the development of word bound blanks in the apertium stream format.

Features[edit]

Transfer (Pull Request 1, Pull Request 2)[edit]

Chunker/Single-stage transfer[edit]

  • Wordbound blanks are a part of transfer word as a new side: blank.
  • Are ignored in pattern matching
  • Wordbound blanks are added just before the output LU from the LU that the lem/lemh is clipped from.
  • If the lem/lemh comes from a variable in the output then the balnk come from the LU which the lemma comes from, by tracing its variable assignment in <let>.
  • No regression. Stream without wordbound blanks work as-is.
  • Normal blanks don't move around while wordbound blanks move around.
  • When MLUs are formed the blanks are merged.
  • Tests added
  • If rule pattern has only one LU, the wordbound blank gets output with all output LUs of the rule

Interchunk[edit]

  • No change needed as inter chunk doesn't access LUs inside the chunk.

Postchunk[edit]

  • Wordbound blanks are ignored in pattern matching
  • Wordbound blanks are added just before the output LU from the LU that the lem/lemh/whole is clipped from.
  • If the lem/lemh comes from a variable in the output then the blank comes from the LU which the lemma comes from, by tracing its variable assignment in .
  • No regression. Stream without wordbound blanks work as-is.
  • Normal blanks don't move around while wordbound blanks move around.
  • When MLUs are formed the blanks are merged.
  • Tests added
  • If rule pattern chunk has only one LU, the wordbound blank gets output with all output LUs of the rule

Recursive Transfer (Pull Request)[edit]

  • Wordbound blanks are read as part of LUs as a new side->wblank.
  • Wblanks reorder with the LUs in transfer based on where the lemma is clipped from.
  • Works even if lemma is clipped into a variable and the variable is later added in the output.
  • No regression. Stream without wordbound blanks work as-is.
  • Normal blanks don't move around while wordbound blanks move around.
  • When MLUs are formed the blanks are merged.
  • Tests added

Pretransfer (Pull Request)[edit]

  • Wordbound blanks distribute across parts when compounds are split into individual LUs

Separable (Pull Request)[edit]

  • Merge wordbound blanks and add to all LUs in rule output.
  • Works for both autoseq and revautoseq.

Analysis, Biltrans, Generation (Pull Request)[edit]

  • Parsing wordbound blanks as normal blanks for analysis, generation, biltrans.
  • Added a test for wordbound blank analysis.

Streamparser (Pull Request)[edit]

  • Wordbound blanks parsed as part of a lexical unit in the stream parser.
  • Can be accessed by class member: LexicalUnit.wordbound_blank.

Postgeneration (Pull Request)[edit]

  • Wordbound blanks merge when words merge.
  • Wordbound blanks apply to all output words when output of postgen rule are more than input words.
  • No regression for postgeneration without wordbound blanks.
  • Lots of tests added.

Rationale[edit]

Wordbound blanks will store information about a lexical unit that can help us with several applications where we want to send information through the pipeline but this information can't be sent as tags because it would break the FST matching in the modules.

We want to store it with a lexical unit, as throughout the pipe lexical units split, merge, delete and get added, and we want that this information distributes over multiple output words, merges on the output words, etc.

Formalism[edit]

Wordbound blanks will be denoted by double square brackets and will always appear right before a Lexical Unit.

[[wordboundblank]]^LU<tags>$

If there is no Lexical Unit in the stream (before the morph analyser and after the generator), then we have an end wblank as well.

[[wordboundblank]]word[[/]] word2 word3 [[wordboundblank]]word4[[/]]


Full Pipe Testing[edit]

Current Translation Command: apertium-deshtml < html_input-eng.in | apertium -f none -d $PREFIX/apertium-eng-spa eng-spa | apertium-retxt

Wordbound blank with Transfuse Command: tf-html-fragment $PREFIX/apertium-eng-spa/modes/eng-spa.mode < html_input-eng.in

Spanish - Catalan[edit]

Source: <p>Es <s>además</s> de Valencia.</p>
Current Translation: <p>És <s>a més de</s>  València.</p>
Ideal Translation: <p>Es <s>además</s> de Valencia.</p>
After wordbound blanks: <p>És <s>a més</s> de València.</p>

Spanish - English[edit]

Source: legal <b>persons</b>
Current Translation: Personas jurídicas <b></b>
Ideal Translation: <b>Personas</b> legales
After wordbound blanks:  <b>Personas</b> legales

Note: Multiword not recognised because of multiple blanks between the words. Can be updated if needed.

Source: I <b>am</b> David
Current Translation:  <b>soy David</b> 
Ideal Translation: <b>Soy</b> David
After wordbound blanks:  <b>Soy</b> David

Source: <p>Bees <b>cannot</b> swim</p>
Current Translation: <p>Las abejas <b>no pueden</b> nadar</p>
Ideal Translation: <p>Las Abejas <b>no pueden</b> nadar</p>
After wordbound blanks: <p>Las abejas <b>no pueden</b> nadar</p>

Source: <a href="Conway">Conway</a> stated that young <a href="children">children</a><i>“understand <a href="Object_permanence">object permanence</a>. <a href="Concealment">Concealed</a> <a href="Object">objects</a> feature in their awareness.”</i><span typeof="mw:Extension/ref"><a href="#ref-5">[5]</a></span><b>(<a href="Nielsen">Nielsen</a> equivalence).</b>
Current Translation: <a href="Conway">*Conway</a> Declaró que los niños <a href="children">jóvenes</a><i>“entienden <a href="Object_permanence">permanencia de objeto</a>. <a href="Concealment">Encubierto</a> <a href="Object">objeta</a> característica en su concienciación.”</i><span typeof="mw:Extension/ref"><a href="#ref-5">[5]</a></span><b>(<a href="Nielsen">*Nielsen</a> equivalencia).</b>
Ideal Translation:
After wordbound blanks: <a href="Conway">*Conway</a> Declaró que los <a href="children">niños</a> jóvenes“<i>entienden <a href="Object_permanence">permanencia</a></i> de <i> <a href="Object_permanence">objeto</a></i><i>. <a href="Concealment">Encubierto</a> </i> <i><a href="Object">objeta</a> </i> <i>característica en</i> <i>su concienciación</i><i>.</i>”<span typeof="mw:Extension/ref"><a href="#ref-5">\[</a></span><span typeof="mw:Extension/ref"><a href="#ref-5">5</a></span><span typeof="mw:Extension/ref"><a href="#ref-5">\]</a></span><b>(<a href="Nielsen">*Nielsen</a> </b> <b>equivalencia)</b><b>.</b>

Source: <p><b><i>my sister</i><br/>lives</b> <u>in Wales</u></p>
Current Translation: <p><b><i>Mis vidas</i><br/>de hermana</b> <u>en Gales</u></p>
Ideal Translation:
After wordbound blanks:

Note: ERROR! todo

Source: <b>The</b> <i>sister</i>'s <em>dog</em>
Current Translation: <b>El perro</i> de la <em></b> <i>hermana</em>
Ideal Translation:
After wordbound blanks:  <em>El perro</em> <b>de l</b> <i>a hermana</i>

Note: Need to check!

From [tests]:

Source: <p>A <b>Japanese</b> <i>BBC</i> article</p>
Current Translation: <p>Una <b>prenda</b> <i>de BBC</i> japonesa</p>
Ideal Translation:
After wordbound blanks: <p>Una prenda de <i>BBC</i> <b>japonesa</b> </p>

Source: <div>A <b>modern</b> Britain.</div>
Current Translation: <div>Una <b>Gran Bretaña</b> moderna.</div>
Ideal Translation: <div>Una Gran Bretaña <b>moderna</b>.</div>
After wordbound blanks: <div>Una Gran Bretaña <b>moderna</b> .</div>

Source: <p>The <b>big <i>red</i></b> dog</p>
Current Translation: <p>El <b>perro <i>rojo</i></b> grande</p>
Ideal Translation: <p>El perro <b><i>rojo</i></b> <b>grande</b></p>
After wordbound blanks: <p>El perro <b> <i>rojo</i></b> <b>grande</b> </p>

Source: <p>He said "<i>I tile <a href="x">bathrooms</a>.</i>"</p>
Current Translation: <p> Diga "<i>#I baños <a href="x">de azulejo</a>.</i>"</p>
Ideal Translation: <p>Diga que "<i>enladrillo</i> <i><a href="x">baños</a></i>."</p>
After wordbound blanks: <p>Diga "<i>#I <a href="x">baños</a></i> de <i>azulejo.</i>"</p>

Source: <p>The <b>big red</b> dog</p>
Current Translation: <p>El <b>perro rojo</b> grande</p>
Ideal Translation: <p>El perro <b>rojo grande</b></p>
After wordbound blanks: <p>El perro <b>rojo grande</b> </p>

Source: <p>The <b>big</b> <b>red</b> dog</p>
Current Translation:  <p>El <b>perro</b> <b>rojo</b> grande</p>
Ideal Translation: <p>El perro <b>rojo</b> <b>grande</b></p>
After wordbound blanks: <p>El perro <b>rojo</b> <b>grande</b> </p>

Source: <p>The <a href="1">big</a> <a href="2">red</a> dog</p>
Current Translation: <p>El <a href="1">perro</a> <a href="2">rojo</a> grande</p>
Ideal Translation: <p>El perro <a href="2">rojo</a> <a href="1">grande</a></p>
After wordbound blanks: <p>El perro <a href="2">rojo</a> <a href="1">grande</a> </p>

Source: <p id="8"><span class="cx-segment" data-segmentid="9"><a class="cx-link" data-linkid="17" href="./The_New_York_Times" rel="mw:WikiLink" title="The New York Times">The New York Times</a>, which has an <b>executive editor</b> over the news pages and an <b>editorial page editor</b> over opinion pages.</span></p>
Current Translation: <p id="8"><span class="cx-segment" data-segmentid="9"><a class="cx-link" data-linkid="17" href="./The_New_York_Times" rel="mw:WikiLink" title="The New York Times">The New York Times</a>, el cual tiene un <b>editor ejecutivo</b> sobre las páginas noticiosas y un <b>editor de página del editorial</b> encima páginas de opinión.</span></p>
Ideal Translation: <p id="8"><span data-segmentid="9" class="cx-segment"><a title="The New York Times" rel="mw:WikiLink" href="./The_New_York_Times" data-linkid="17" class="cx-link">The New York Times</a>, el cual tiene un <b>editor ejecutivo</b> sobre las páginas noticiosas y un <b>editor de página del editorial</b> encima páginas de opinión.</span></p>
After wordbound blanks: <p id="8"><span class="cx-segment" data-segmentid="9"><a class="cx-link" data-linkid="17" href="./The_New_York_Times" rel="mw:WikiLink" title="The New York Times">The New York Times</a>, el cual tiene un <b>editor ejecutivo</b> sobre las páginas noticiosas y un <b>editor</b> de <b>página</b> del <b>editorial</b> encima páginas de opinión.</span></p>

Previous Attempts[edit]

References[edit]