Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Xavi Ivars
Forget about it, that one has always been python3. I just got confused with
the genv*dix scripts

El dv., 13 de set. 2019, 12:45, Xavi Ivars  va
escriure:

> El dv., 13 de set. 2019, 12:28, Tino Didriksen 
> va escriure:
>
>> [...]
>>
>> I think only -por-cat uses both metalrx and metalrx-to-lrx, so if you
>> want to merge their functionality it should be harmless enough.
>>
>
> fra-cat (the pair I initially implemented the python script for) also uses
> both.
>
> https://github.com/apertium/apertium-fra-cat/blob/master/Makefile.am#L122
>
> What I'm not sure is why it seems the python script in there is already
> python3 compatible
> --
> Xavi Ivars
> < http://xavi.ivars.me >
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Xavi Ivars
El dv., 13 de set. 2019, 12:28, Tino Didriksen 
va escriure:

> [...]
>
> I think only -por-cat uses both metalrx and metalrx-to-lrx, so if you want
> to merge their functionality it should be harmless enough.
>

fra-cat (the pair I initially implemented the python script for) also uses
both.

https://github.com/apertium/apertium-fra-cat/blob/master/Makefile.am#L122

What I'm not sure is why it seems the python script in there is already
python3 compatible
--
Xavi Ivars
< http://xavi.ivars.me >
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Tino Didriksen
I've now converted apertium-cat, -por, -por-cat, and -es-pt to use the
shared scripts. Many more repos can benefit from this. I also removed
INSTALL from por's history, so that needs to be recloned.

Also simplified their configure.ac to the minimum required, and made use of
CG-3's pkg-config. Once apertium-lex-tools, -separable, -anaphora,
-recursive have pkg-configs, various configure.ac can be even further
simplified.

https://github.com/apertium/apertium/tree/master/scripts now also
has translate-to-default-equivalent which is used in many pairs. It used to
produce ISO-8859-1 outputs, but I fixed that to UTF-8.

Changesets for inspection:
https://github.com/apertium/apertium-por/commit/1bd676e6e1c51089bf435d6f31465184d2243558
https://github.com/apertium/apertium-cat/commit/0511ed02709c5011f02308e7b432cd9f40a63b2f
https://github.com/apertium/apertium-por-cat/commit/2cfdd200cff9f94e05b57155f14879ad56a42780
https://github.com/apertium/apertium-es-pt/commit/da1f310ec0aabf0fe6d08cf6fe2da6de7d176616

I think only -por-cat uses both metalrx and metalrx-to-lrx, so if you want
to merge their functionality it should be harmless enough.

-- Tino Didriksen


On Fri, 13 Sep 2019 at 03:39, Xavi Ivars  wrote:

> El dv., 13 de set. 2019, 1:27, Kevin Brubeck Unhammer 
> va escriure:
>
>>
>> So it seems the python script
>> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx
>> lets you do  with templates like {{pfoo}}:
>>
>> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L5
>> that the caller can replace:
>>
>> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L3223
>>
>> Perhaps
>>
>> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx-to-lrx.in
>> should call both the XSLT and the python script? It seems they should be
>> compatible, doing nothing if the special features aren't used. (If so,
>> scripts/apertium-metalrx should probably be named somethingelse.py.)
>>
>
> Yes, I built that python script as a quick hack to see if that could be
> done, and never really improved or documented it. My bad.
>
> Originally, I tried extending somehow the xslt, but I after spending too
> much time figuring it out, I decided to go with a simple python script.
>
> It's compatible with the xslt: if I remember correctly, it needs to be
> applied before, but that's about it in terms of requirements.
>
> Personally, I'd also bundle xslt logic into the same script. I think
> python is way more readable than xslt, but didn't do that either for
> several reasons:
> * xslt "was already there". It existed in the past, and whoever
> implemented that in xslt had (probably) a good reason to
> * new python dependency: didn't want to introduce python dependency to all
> packages that used to use the xslt script
> * consistency across pairs: if python was not added everywhere, the
> alternative would be to have some pairs with that logic being done via the
> xslt script and some others via the python one
>
> But I think now it's a good opportunity to consolidate, decide where we
> want to go (I'd vote for python helper scripts), and try to document it.
>
> --
> Xavi Ivars
> < http://xavi.ivars.me >
> ___
> Apertium-stuff mailing list
> Apertium-stuff@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Xavi Ivars
El dv., 13 de set. 2019, 1:27, Kevin Brubeck Unhammer 
va escriure:

>
> So it seems the python script
> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx
> lets you do  with templates like {{pfoo}}:
>
> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L5
> that the caller can replace:
>
> https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L3223
>
> Perhaps
>
> https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx-to-lrx.in
> should call both the XSLT and the python script? It seems they should be
> compatible, doing nothing if the special features aren't used. (If so,
> scripts/apertium-metalrx should probably be named somethingelse.py.)
>

Yes, I built that python script as a quick hack to see if that could be
done, and never really improved or documented it. My bad.

Originally, I tried extending somehow the xslt, but I after spending too
much time figuring it out, I decided to go with a simple python script.

It's compatible with the xslt: if I remember correctly, it needs to be
applied before, but that's about it in terms of requirements.

Personally, I'd also bundle xslt logic into the same script. I think python
is way more readable than xslt, but didn't do that either for several
reasons:
* xslt "was already there". It existed in the past, and whoever implemented
that in xslt had (probably) a good reason to
* new python dependency: didn't want to introduce python dependency to all
packages that used to use the xslt script
* consistency across pairs: if python was not added everywhere, the
alternative would be to have some pairs with that logic being done via the
xslt script and some others via the python one

But I think now it's a good opportunity to consolidate, decide where we
want to go (I'd vote for python helper scripts), and try to document it.

--
Xavi Ivars
< http://xavi.ivars.me >
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Hèctor Alòs i Font
Jonathan,
I have been using them a lot in the last two years. You can take a look,
for instance, to the Catalan-Italian pair:
https://github.com/apertium/apertium-cat-ita/blob/master/apertium-cat-ita.cat-ita.metalrx
https://github.com/apertium/apertium-cat-ita/blob/master/apertium-cat-ita.ita-cat.metalrx
There are also macros, which are very useful. For instance, I often have a
different translation for a pronominal and a non-pronominal use of the
verb. The macro "understands" whether we are in one case or the other, and
you don't have to copy-past lots of identical rules, with different verbs.
This was done by Xavi.

Missatge de Tino Didriksen  del dia dj., 12 de
set. 2019 a les 21:01:

> https://github.com/apertium/apertium-por-cat uses both metalrx.py and the
> XSLT.
>
> I have moved all these shared scripts and XSLTs to apertium (
> https://github.com/apertium/apertium/tree/master/scripts ), and will be
> updating languages/pairs to use them from there.
>
> -- Tino Didriksen
>
>
> On Thu, 12 Sep 2019 at 19:16, Jonathan Washington <
> jonathan.n.washing...@gmail.com> wrote:
>
>> I'm curious about metalrx.py.  Where is it used?  What does it do?  Is it
>> documented anywhere?  I've been using an xslt file I found in a Sámi pair
>> for creating lrx from metalrx.
>>
>> --
>> Jonathan
>>
> ___
> Apertium-stuff mailing list
> Apertium-stuff@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Kevin Brubeck Unhammer
Tino Didriksen 
čálii:

> https://github.com/apertium/apertium-por-cat uses both metalrx.py and the
> XSLT.
>
> I have moved all these shared scripts and XSLTs to apertium (
> https://github.com/apertium/apertium/tree/master/scripts ), and will be
> updating languages/pairs to use them from there.

So it seems the python script 
https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx
lets you do  with templates like {{pfoo}}:
https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L5
that the caller can replace:
https://github.com/apertium/apertium-por-cat/blob/master/apertium-por-cat.cat-por.metalrx#L3223

Perhaps
https://github.com/apertium/apertium/blob/master/scripts/apertium-metalrx-to-lrx.in
should call both the XSLT and the python script? It seems they should be
compatible, doing nothing if the special features aren't used. (If so,
scripts/apertium-metalrx should probably be named somethingelse.py.)


signature.asc
Description: PGP signature
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Tino Didriksen
https://github.com/apertium/apertium-por-cat uses both metalrx.py and the
XSLT.

I have moved all these shared scripts and XSLTs to apertium (
https://github.com/apertium/apertium/tree/master/scripts ), and will be
updating languages/pairs to use them from there.

-- Tino Didriksen


On Thu, 12 Sep 2019 at 19:16, Jonathan Washington <
jonathan.n.washing...@gmail.com> wrote:

> I'm curious about metalrx.py.  Where is it used?  What does it do?  Is it
> documented anywhere?  I've been using an xslt file I found in a Sámi pair
> for creating lrx from metalrx.
>
> --
> Jonathan
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Jonathan Washington
Thanks, Kevin.  Yes, that's the approach I use.  It's not well-documented,
but it's pretty straightforward.

Do you know anything about the metalrx.py script that Tino mentioned?

--
Jonathan


On Thu, Sep 12, 2019, 13:47 Kevin Brubeck Unhammer 
wrote:

> Jonathan Washington
>  čálii:
>
> > I'm curious about metalrx.py.  Where is it used?  What does it do?  Is it
> > documented anywhere?  I've been using an xslt file I found in a Sámi pair
> > for creating lrx from metalrx.
>
> The Sámi pairs use an XSLT script
>
> https://github.com/apertium/apertium-sme-sma/blob/master/metalrx-to-lrx.xslt
> that two extra functions to lrx files:
>
> 1. , see example at
>
> https://github.com/apertium/apertium-sme-sma/blob/master/apertium-sme-sma.sme-sma.metalrx#L3
>for often-used sequences (that file just has a single , but you
>could have several in a row)
>
> 2.  you can wrap around a  or  or  to
>repeat it up to n times:
>
> https://github.com/apertium/apertium-sme-sma/blob/master/apertium-sme-sma.sme-sma.metalrx#L2184
>
> ___
> Apertium-stuff mailing list
> Apertium-stuff@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Kevin Brubeck Unhammer
Jonathan Washington
 čálii:

> I'm curious about metalrx.py.  Where is it used?  What does it do?  Is it
> documented anywhere?  I've been using an xslt file I found in a Sámi pair
> for creating lrx from metalrx.

The Sámi pairs use an XSLT script
https://github.com/apertium/apertium-sme-sma/blob/master/metalrx-to-lrx.xslt
that two extra functions to lrx files:

1. , see example at
   
https://github.com/apertium/apertium-sme-sma/blob/master/apertium-sme-sma.sme-sma.metalrx#L3
   for often-used sequences (that file just has a single , but you
   could have several in a row)

2.  you can wrap around a  or  or  to
   repeat it up to n times:
   
https://github.com/apertium/apertium-sme-sma/blob/master/apertium-sme-sma.sme-sma.metalrx#L2184



signature.asc
Description: PGP signature
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Jonathan Washington
I'm curious about metalrx.py.  Where is it used?  What does it do?  Is it
documented anywhere?  I've been using an xslt file I found in a Sámi pair
for creating lrx from metalrx.

--
Jonathan

On Thu, Sep 12, 2019, 02:19 Tino Didriksen  wrote:

> Maybe I can do it myself, then. 2to3 did most of it, but I just gave up
> when the result didn't work immediately.
>
> I would absolutely say they belong in apertium's apertium-dev subpackage.
> The scripts may be written in Python, but they don't rely on the
> apertium-python API - they could be written in any language. Hence why they
> must also be installed without the .py suffix.
>
> I would move them into apertium first, make sure they get installed and
> work, then adjust the languages.
>
> Centralization also applies to metalrx.py and any other helper script that
> gets used across multiple languages/pairs.
>
> -- Tino Didriksen
>
>
> On Thu, 12 Sep 2019 at 06:49, Xavi Ivars  wrote:
>
>> I won't be able to do anything before September 20th (on vacation,
>> without computer around).
>>
>> Once I get there, I'll change the scripts. Not sure how to do it so they
>> "become" part of the apertium package, so I'll try to do out in multiple
>> steps: first convert to python3 and then, move out.
>>
>> Would it be better to create a python package to contain these type of
>> scripts, instead of bundling everything into apertium?
>>
>>
>> --
>> Xavi Ivars
>>
> ___
> Apertium-stuff mailing list
> Apertium-stuff@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff


Re: [Apertium-stuff] genv*dix.py need conversion

2019-09-12 Thread Tino Didriksen
Maybe I can do it myself, then. 2to3 did most of it, but I just gave up
when the result didn't work immediately.

I would absolutely say they belong in apertium's apertium-dev subpackage.
The scripts may be written in Python, but they don't rely on the
apertium-python API - they could be written in any language. Hence why they
must also be installed without the .py suffix.

I would move them into apertium first, make sure they get installed and
work, then adjust the languages.

Centralization also applies to metalrx.py and any other helper script that
gets used across multiple languages/pairs.

-- Tino Didriksen


On Thu, 12 Sep 2019 at 06:49, Xavi Ivars  wrote:

> I won't be able to do anything before September 20th (on vacation, without
> computer around).
>
> Once I get there, I'll change the scripts. Not sure how to do it so they
> "become" part of the apertium package, so I'll try to do out in multiple
> steps: first convert to python3 and then, move out.
>
> Would it be better to create a python package to contain these type of
> scripts, instead of bundling everything into apertium?
>
>
> --
> Xavi Ivars
>
___
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff