Skip to content

Commit

Permalink
Release 2.2.0; Use shared tools; Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
TinoDidriksen committed Nov 20, 2019
1 parent b3761b4 commit cd67aeb
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 443 deletions.
17 changes: 11 additions & 6 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
2010-2017, Xavi Ivars <[email protected]>
2017, Hèctor Alòs i Font <[email protected]>
2013-2017, Kevin Brubeck Unhammer <[email protected]>
2007-2016, Gema Ramírez Sánchez <[email protected]>
2007-2015, Mikel L. Forcada <[email protected]>
2007-2015, Francis M. Tyers <[email protected]>
2017-2019, Jaume Ortolà i Font <[email protected]>
2010-2019, Xavi Ivars <[email protected]>
2018-2019, Marc Riera Irigoyen <[email protected]>
2017-2019, Hèctor Alòs i Font <[email protected]>
2007-2019, Gema Ramírez Sánchez <[email protected]>
2013-2019, Kevin Brubeck Unhammer <[email protected]>
2017-2019, Donís Seguí <[email protected]>
2018, Alberto Navalon <[email protected]>
2007-2018, Mikel L. Forcada <[email protected]>
2007-2018, Francis M. Tyers <[email protected]>
2018, Sushain Cherivirala <[email protected]>
2007-2014, Sergio Ortiz Rojas <[email protected]>
2008-2012, Jim O'Regan <[email protected]>
2012, Anthony J. Bentley <[email protected]>
Expand Down
23 changes: 10 additions & 13 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
## Makefile for Spanish--Catalan
###############################################################################

VERSION=2.1.0
LANG1=spa
LANG2=cat

Expand Down Expand Up @@ -144,16 +143,16 @@ $(PREFIX2).rlx.bin: $(AP_SRC2)/apertium-$(LANG2).$(LANG2).rlx
###############################################################################

.deps/$(PREFIX1).dix: $(BASENAME).$(PREFIX1).dix .deps/.d
xsltproc translate-to-default-equivalent.xsl $< > $@
apertium-translate-to-default-equivalent $< $@

.deps/$(PREFIX1).cat.dix: .deps/$(PREFIX1).dix
python genvrdix.py cat $< >$@
apertium-genvrdix cat $< >$@

.deps/$(PREFIX1).val_gva.dix: .deps/$(PREFIX1).dix
python genvrdix.py val_gva $< >$@
apertium-genvrdix val_gva $< >$@

.deps/$(PREFIX1).val_uni.dix: .deps/$(PREFIX1).dix
python genvrdix.py val_uni $< >$@
apertium-genvrdix val_uni $< >$@

$(PREFIX1C).autobil.bin: .deps/$(PREFIX1).cat.dix
apertium-validate-dictionary $<
Expand All @@ -176,12 +175,10 @@ $(PREFIX2).autobil.bin: $(BASENAME).$(PREFIX1).dix
###############################################################################

.deps/%.metalrx: %.metalrx
python3 metalrx.py $< $@
apertium-metalrx $< $@

.deps/%.lrx: metalrx-to-lrx.xslt .deps/%.metalrx
xsltproc $^ > $@.tmp
@xmllint --format $@.tmp > $@
@rm $@.tmp
.deps/%.lrx: .deps/%.metalrx
apertium-metalrx-to-lrx $< $@

$(PREFIX1).autolex.bin: .deps/$(BASENAME).$(PREFIX1).lrx
lrx-comp $< $@
Expand All @@ -207,13 +204,13 @@ $(PREFIX1U).t1x.bin: $(PREFIX1U).t1x
apertium-preprocess-transfer $< $@

.deps/$(BASENAME).$(PREFIX1).cat.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py cat $< >$@
python3 gent1x.py cat $< >$@

.deps/$(BASENAME).$(PREFIX1).val_gva.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py val_gva $< >$@
python3 gent1x.py val_gva $< >$@

.deps/$(BASENAME).$(PREFIX1).val_uni.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py val_uni $< >$@
python3 gent1x.py val_uni $< >$@

$(PREFIX1C).t1x: .deps/$(BASENAME).$(PREFIX1).cat.t1x
xsltproc --stringparam alt cat alt.xsl $< >$@
Expand Down
13 changes: 6 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
AC_PREREQ(2.52)

AC_INIT([Apertium Spanish-Catalan], [2.1.0], [[email protected]], [apertium-spa-cat], [http://wiki.apertium.org/wiki/Apertium-spa-cat])
AC_INIT([Apertium Spanish-Catalan], [2.2.0], [[email protected]], [apertium-spa-cat], [http://wiki.apertium.org/wiki/Apertium-spa-cat])
AM_INIT_AUTOMAKE

AC_PROG_LN_S
AC_PROG_AWK

m4_define([required_apertium_version], [3.4.0])
PKG_CHECK_MODULES(APERTIUM, apertium >= required_apertium_version, [], [PKG_CHECK_MODULES(APERTIUM, apertium-3.2 >= required_apertium_version)])
PKG_CHECK_MODULES(APERTIUM, apertium >= 3.6.0)
PKG_CHECK_MODULES(LTTOOLBOX, lttoolbox >= 3.5.0)
PKG_CHECK_MODULES(CG3, cg3 >= 1.3.0)

AC_PATH_PROGS(ZCAT, [gzcat zcat], [false])
AS_IF([test x$ZCAT = xfalse], [AC_MSG_ERROR([You don't have zcat nor gzcat installed])])

m4_ifdef([AP_CHECK_LING],[],[AC_MSG_ERROR([AP_CHECK_LING not defined, is apertium.m4 in ACLOCAL_PATH? See: http://wiki.apertium.org/wiki/Installation_troubleshooting])])

AP_CHECK_LING([1], [apertium-spa])
AP_CHECK_LING([2], [apertium-cat])
AP_CHECK_LING([1], [apertium-spa], [1.2.0])
AP_CHECK_LING([2], [apertium-cat], [2.8.0])

AP_MKINCLUDE

AC_OUTPUT([Makefile])

25 changes: 12 additions & 13 deletions gent1x.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ def printAttrs(attrsmap):
if len(attrsmap) == 0:
return ""
output = []
for (i,j) in attrsmap.items():
for (i,j) in list(attrsmap.items()):
output.append(i)
output.append("=\"")
output.append(saxutils.escape(j))
output.append("\" ")
return " " + "".join(output).strip()

return " " + "".join(output).strip()

class DixHandler(handler.ContentHandler):
def __init__(self, out = sys.stdout):
handler.ContentHandler.__init__(self)
self._out = out
self._buf = []

def flush(self):
for i in self._buf:
self._out.write(i.encode("utf-8"))
self._out.write(i)
self._buf = []


def startElement(self, name, attrs):
if "alt" in attrs:
attrs2 = {i:j for (i,j) in attrs.items() if i != "alt"}
attrs2 = {i:j for (i,j) in list(attrs.items()) if i != "alt"}
vals = attrs["alt"].split()
if alternative in vals:
attrs2["alt"] = alternative
else:
attrs2["alt"] = alt_other
attrs = attrs2
self._buf.append("<" + name + printAttrs(attrs) + ">")

def endElement(self, name):
if len(self._buf) > 0 and self._buf[-1][0:1] == "<" and self._buf[-1][-1:] == ">" and self._buf[-1][1:2] != "/":
self._buf[-1] = self._buf[-1][0:-1]+"/>"
Expand All @@ -53,14 +53,13 @@ def endElement(self, name):
self._out.write("</")
self._out.write(name)
self._out.write(">")

def characters(self, content):
self.flush()
self._out.write(saxutils.escape(content).encode("utf-8"))
self._out.write(saxutils.escape(content))

parser = make_parser()
parser.setContentHandler(DixHandler())

with open(dixfile, "r") as f:
parser.parse(f)

66 changes: 0 additions & 66 deletions genvrdix.py

This file was deleted.

129 changes: 0 additions & 129 deletions metalrx-to-lrx.xslt

This file was deleted.

Loading

0 comments on commit cd67aeb

Please sign in to comment.