2010/9/28 Jimmy O'Regan <[email protected]>

> 2010/9/28 Miquel Esplà <[email protected]>:
> > Hi everybody,
> > I've been having some problems while translating a file from English to
> > Spanish. I've created a file with a list of sentences in English. Each of
> > these sentences is ended with a null character ('\0'). When I transalted,
> I
> > discovered two problems:
> > - Some words at the end of the sentence desapaired.
> > - Some sentences appeared joined in the same line.
>
> Do you have any specific examples? Null flush is a relatively obscure
> feature.


I have performed some tests with a very short file which I reproduce here
(in the real file, each sentence ends with a null character):
ENGLISH FILE:
*products of the clock *
*the agreement *
*member states and the *
*its member *
*agreement to the agreement *
*of *
*to the agreement *

TRANSLATION:
*Productos del reloj *
*el acuerdo *
*estados de miembro *
*su *
*acuerdo al acuerdo *
*
*
*al acuerdo *
As you can see, the translation of the word *of *don't appear. In the same
way, for the sentences *member states and the *and *its member* there are
some words which are not translated. That's the problem wich I solved with
the changes in the lttoolbox obtaining:
*Productos del reloj *
*el acuerdo *
*estados de miembro y el *
*su miembro *
*acuerdo al acuerdo *
*de *
*al acuerdo*
*
*
The other problem I found was that, sometimes, some sentences were joined in
an only one:
ENGLISH:
*as follows *
*have *
*article 1 *
*article *
*1 *

SPANISH:
*cuando sigue *
*haber artículo 1 *
*artículo *
*1 *

That is what I sovled in the Apertium code.

>


> > I've been checking the code and I have performed some changes on it. I
> > solved the first problem in the fst_processor.cc file in the lttoolbox. I
> > solved the second problem changing a line in the transfer.cc in the
> Apertium
> > code. The changes I performed makes the translator to work, but I don't
> know
> > too much the code and I would preffer someone who knows it better than me
> to
> > take a look to the diff files (attached). If you agree the changes, I can
> > add them to the SVN.
>
> Please, use 'diff -u'  or 'svn diff'
>

Ok, in the files which I'm attaching I used diff -u.


>
> 1860c1861
> <         tmpblank.push_back(&current.getContent());
> ---
> >         //tmpblank.push_back(&current.getContent());
>
> That doesn't look right at all. Have you tried the same set of problem
> sentences using the normal mode, with that change applied?
>
>
Ups! Yes, that's not right, is a change which I made when I was performing
some tests to find the problem and I forgot to change it back. Now
everything is right.


> --
> <Leftmost> jimregan, that's because deep inside you, you are evil.
> <Leftmost> Also not-so-deep inside you.
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Apertium-stuff mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
--- fst_processor.cc	2010-09-30 09:42:23.000000000 +0200
+++ lttoolbox-3.2.0/lttoolbox/fst_processor.cc	2010-04-13 02:58:40.000000000 +0200
@@ -826,9 +826,8 @@
   int last = 0;
   bool firstupper = false, uppercase = false;
 
-  wchar_t val;
-  do{
-    val = readAnalysis(input);
+  while(wchar_t val = readAnalysis(input))
+  {
     // test for final states
     if(current_state.isFinal(all_finals))
     {
@@ -1044,7 +1043,7 @@
       last_postblank = false;
       last_preblank = false;
     }
-  }while(val);
+  }
   
   // print remaining blanks
   flushBlanks(output);
@@ -1410,10 +1409,8 @@
   int last = 0;
   set<wchar_t> empty_escaped_chars;
 
-  wchar_t val;
-  //while(wchar_t val = readPostgeneration(input))
-  do{
-    val=readPostgeneration(input);
+  while(wchar_t val = readPostgeneration(input))
+  {
     if(val == L'~')
     {
       skip_mode = false;
@@ -1558,7 +1555,7 @@
 	skip_mode = true;
       }
     }
-  }while(val);
+  }
   
   // print remaining blanks
   flushBlanks(output);  
--- apertium-3.2.0/apertium/transfer.cc	2010-09-30 09:41:32.000000000 +0200
+++ apertium-3.2.0/apertium/transfer.ccc	2010-09-30 09:41:15.000000000 +0200
@@ -1827,7 +1827,6 @@
 	else if(tmpblank.size() != 0)
 	{
 	  fputws_unlocked(tmpblank[0]->c_str(), output);
-          fflush(output);
 	  tmpblank.clear();
 	  last = input_buffer.getPos();
 	  ms.init(me->getInitial());
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Apertium-stuff mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to