Hi Kevin,
your new solution with rtx would be of interest. I´ve attached your old Python
script.
Your answer from 2018:
$ curl http://termbin.com/sah4 >pres2pret.py
$ curl
https://raw.githubusercontent.com/goavki/streamparser/master/streamparser.py
>streamparser.py
$ sudo apt install apertium-nno
$ echo 'ååh hald no opp, eg gjer det etter kvart.' |\
apertium-deshtml -n |\
lt-proc /usr/share/apertium/apertium-nno/nno.automorf.bin |\
cg-proc -1 /usr/share/apertium/apertium-nno/nno.rlx.bin |\
python3 pres2pret.py |\
lt-proc -g /usr/share/apertium/apertium-nno/nno.autogen.bin |\
apertium-rehtml-noent
which gives the (rather ungrammatical) answer "ååh hald no opp, eg
gjorde det etter kvart".
The link once again:
https://sourceforge.net/p/apertium/mailman/apertium-stuff/thread/1519736195.3991384.1284992528.191E054E%40webmail.messagingengine.com/#msg36238830
Or search for "change of tense" in the list archives. The original subject was:
Automatic change of tense
--
Vänligen
Per Tunedal
On Mon, Feb 14, 2022, at 20:10, Kevin Brubeck Unhammer wrote:
>> The link in that earlier email is dead, so I can't see what the original
>> script was doing, but based on the name it might have just been replacing
>> <pres> with <pret>, in which case, if you still have that script, you could
>> just edit it to replace <p1> with <p3>.
>
> Wops, I should've attached it …
>
> These days I think I'd use rtx for this, probably would be an even
> shorter file =D
>
> _______________________________________________
> Apertium-stuff mailing list
> Apertium-stuff@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>
> Attachments:
> * signature.asc
#!/usr/bin/env python3
import sys
from streamparser import parse_file, readingToString, known, SReading
for blank, lu in parse_file(sys.stdin, withText=True):
pres = [s for r in lu.readings for s in r if s.tags == ['vblex', 'pres']]
if pres != []:
pret = [SReading(baseform=s.baseform, tags=['vblex', 'pret'])
for s in pres]
print(blank+" ".join("^{}$".format(readingToString(pret))
for r in lu.readings),
end="")
else:
print(blank+"["+lu.wordform+"]",
end="")
_______________________________________________
Apertium-stuff mailing list
Apertium-stuff@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/apertium-stuff