> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)
> Date: Sat, 28 Jul 2012 17:41:29 +0200
> From: Kevin Brubeck Unhammer <unham...@fsfe.org>
> To: apertium-stuff@lists.sourceforge.net
> Reply-To: apertium-stuff@lists.sourceforge.net
> Subject: Re: [Apertium-stuff] New applications: Apertium Caffeine ... ->
>  formatters and deformatters
> "Bernard Chardonneau" <bechapert...@free.fr>
> writes:
>
> > (.....................)
> >
> > As to me, I think since several months to write formatters and deformatters
> > for man pages and also for mnémonic interface files (on each line, an
> > identifier not to be changed on the left side and a printf formatted string
> > on the right side).
>
> Are these online somewhere?
>

Answer of Sat, 28 Jul 2012 19:24:00 +0200 :

If you speak about the formatters and deformatters, not yet.

If you speak about mnémonic interface files you can see them on
http://libremail.tuxfamily.org/sources/mess-libremail-XX.htm
and
http://cyloop.tuxfamily.org/sources/mess-cyloop-XX.htm

with fr , en , es , pt , eo , eo-utf instead of XX,
or also  de , it or nl for the first link.


Add-on of the 21 Aug 2012 19:01

Now, I wrote the two deformatters and a generic reformater that should also
work as an alternative of apertium-retxt and apertium-rehtml (at least).

Other deformatters and reformatters seems to be generated by a tool, So C
source are not easy to follow, and they are gigantic according what they
are supposed to do.

My sources are written in a very basic C.
After processing command line arguments :

 // input from a file if needed
 if (--argc >= 1)
 {
     if (! freopen (argv [1], "r", stdin))
     {
         fprintf (stderr, "Cannot access to file %s\n", argv [1]);
         return (1);
     }
 }

 // output into a file if needed
 if (argc >= 2)
 {
     if (! freopen (argv [2], "w", stdout))
     {
         fprintf (stderr, "Cannot write result to file %s\n", argv [2]);
         return (2);
     }
 }

all input and output of the programs only use getchar() and putchar(...) 

But interfacing them with Apertium gives strange results.
I first needed to add lines in Apertium script to declare the new
availlable formats :

 man)
        if [[ $UWORDS = "no" ]];
        then OPTION="-n"; 
        else OPTION="-g";
        fi;
        ;;
        
 mnemo)
        if [[ $UWORDS = "no" ]];
        then OPTION="-n"; 
        else OPTION="-g";
        fi;
        ;;

And, so if I do

... | apertium -f man sl-tl
Cannot access to file /dev/stdin

or

... | apertium -f mnemo sl-tl
Cannot access to file /dev/stdin

But
apertium-desman my_man_page.1 | apertium -f none sl-tl | apertium-reman
or
cat my_man_page.1 | apertium-desman | apertium -f none sl-tl | apertium-reman
works.

The same with mnemonic files and apertium-desmnemo stopped working very early
two hours ago when I started writing this add-on. Now it works.

The main error was even inside [ ... ] a \ need to be put twice.
Some other characters than the ones I thought need also to be escaped, and
finaly I thought to ask Apertium the full list :

alphabet | apertium-destxt | sed "s/ /\n/g" | fgrep '\' | cut -c2 | tr "\n" " "
$ / < > @ [ \ ] ^ { }

where alphabet is an old personal command.

I think to send my source files on svn around the 2 of September (after
crossing the country to see again my Internet box).

--------------------------------
Bernard Chardonneau (France)
Phone : [33] 1 64 90 87 04 (from Sept to June except holidays)
GSM phone : [33] 6 49 95 13 95 (french scholl holidays, C zone)

Multilingual websites for my free softwares :
http://libremail.free.fr and http://libremail.tuxfamily.org
http://cyloop.tuxfamily.org (mainly translated with Apertium)

My general website (in french only)
http://bech.free.fr

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to