Commit ac94fcdb authored by Tino Didriksen's avatar Tino Didriksen

Imported Upstream version 2.1.0~r79717

parent 1ecf7bff
......@@ -2,38 +2,46 @@
## Makefile for Spanish--Catalan
###############################################################################
VERSION=2.0.0
VERSION=2.1.0
LANG1=spa
LANG2=cat
VAR1=#leave empty
VAR2=_valencia
VAR2=_valencia_gva
VAR3=_valencia_uni
LANG2C=$(LANG2)$(VAR1)
LANG2V=$(LANG2)$(VAR2)
LANG2U=$(LANG2)$(VAR3)
PREFIX1=$(LANG1)-$(LANG2)
PREFIX1C=$(LANG1)-$(LANG2C)
PREFIX1V=$(LANG1)-$(LANG2V)
PREFIX1U=$(LANG1)-$(LANG2U)
PREFIX2=$(LANG2)-$(LANG1)
PREFIX2C=$(LANG2C)-$(LANG1)
PREFIX2V=$(LANG2V)-$(LANG1)
PREFIX2U=$(LANG2U)-$(LANG1)
BASENAME=apertium-$(PREFIX1)
TARGETS_COMMON = \
$(PREFIX1).automorf.bin \
$(LANG1).lrx.bin \
$(LANG1).lrx.bin \
$(PREFIX1).rlx.bin \
$(PREFIX2).rlx.bin \
$(PREFIX1).prob \
$(PREFIX1C).autobil.bin \
$(PREFIX1V).autobil.bin \
$(PREFIX1U).autobil.bin \
$(PREFIX1).autolex.bin \
$(PREFIX1C).autogen.bin \
$(PREFIX1V).autogen.bin \
$(PREFIX1U).autogen.bin \
$(PREFIX1C).autopgen.bin \
$(PREFIX1V).autopgen.bin \
$(PREFIX1U).autopgen.bin \
$(PREFIX2).automorf.bin \
$(PREFIX2).prob \
$(PREFIX2).autobil.bin \
......@@ -41,6 +49,7 @@ TARGETS_COMMON = \
$(PREFIX2).autopgen.bin \
$(PREFIX1C).t1x.bin \
$(PREFIX1V).t1x.bin \
$(PREFIX1U).t1x.bin \
$(PREFIX2).t1x.bin
......@@ -62,6 +71,9 @@ $(PREFIX1C).automorf.bin: $(AP_SRC1)/$(LANG1).automorf.bin $(PREFIX1C).autobil.b
$(PREFIX1V).automorf.bin: $(AP_SRC1)/$(LANG1).automorf.bin $(PREFIX1V).autobil.bin
lt-trim $^ $@
$(PREFIX1U).automorf.bin: $(AP_SRC1)/$(LANG1).automorf.bin $(PREFIX1V).autobil.bin
lt-trim $^ $@
# -------------------
# Spanish generation:
# ---------------------
......@@ -89,12 +101,18 @@ $(PREFIX1C).autogen.bin: $(AP_SRC2)/$(LANG2C).autogen.bin
$(PREFIX1V).autogen.bin: $(AP_SRC2)/$(LANG2V).autogen.bin
cp $< $@
$(PREFIX1U).autogen.bin: $(AP_SRC2)/$(LANG2U).autogen.bin
cp $< $@
$(PREFIX1C).autopgen.bin: $(AP_SRC2)/$(LANG2C).autopgen.bin
cp $< $@
$(PREFIX1V).autopgen.bin: $(AP_SRC2)/$(LANG2V).autopgen.bin
cp $< $@
$(PREFIX1U).autopgen.bin: $(AP_SRC2)/$(LANG2U).autopgen.bin
cp $< $@
###############################################################################
## Disambiguation models
......@@ -111,6 +129,9 @@ $(LANG1).lrx.bin: $(AP_SRC1)/$(LANG1).lrx.bin
$(PREFIX2).prob: $(AP_SRC2)/$(LANG2).prob
cp $< $@
$(PREFIX2).rlx.bin: $(AP_SRC2)/apertium-$(LANG2).$(LANG2).rlx
cg-comp $< $@
###############################################################################
......@@ -120,19 +141,31 @@ $(PREFIX2).prob: $(AP_SRC2)/$(LANG2).prob
.deps/$(PREFIX1).dix: $(BASENAME).$(PREFIX1).dix .deps/.d
xsltproc translate-to-default-equivalent.xsl $< > $@
$(PREFIX1C).autobil.bin: .deps/$(PREFIX1).dix
.deps/$(PREFIX1).cat.dix: .deps/$(PREFIX1).dix
python genvrdix.py cat $< >$@
.deps/$(PREFIX1).val_gva.dix: .deps/$(PREFIX1).dix
python genvrdix.py val_gva $< >$@
.deps/$(PREFIX1).val_uni.dix: .deps/$(PREFIX1).dix
python genvrdix.py val_uni $< >$@
$(PREFIX1C).autobil.bin: .deps/$(PREFIX1).cat.dix
apertium-validate-dictionary $<
lt-comp --var-right=cat lr $< $@
$(PREFIX1V).autobil.bin: .deps/$(PREFIX1).dix
$(PREFIX1V).autobil.bin: .deps/$(PREFIX1).val_gva.dix
apertium-validate-dictionary $<
lt-comp --var-right=val_gva lr $< $@
$(PREFIX1U).autobil.bin: .deps/$(PREFIX1).val_uni.dix
apertium-validate-dictionary $<
lt-comp --var-right=val lr $< $@
lt-comp --var-right=val_uni lr $< $@
$(PREFIX2).autobil.bin: $(BASENAME).$(PREFIX1).dix
apertium-validate-dictionary $<
lt-comp rl $< $@
###############################################################################
## Lexical selection rules
###############################################################################
......@@ -156,11 +189,27 @@ $(PREFIX1V).t1x.bin: $(PREFIX1V).t1x
apertium-validate-transfer $<
apertium-preprocess-transfer $< $@
$(PREFIX1C).t1x: $(BASENAME).$(PREFIX1).t1x
$(PREFIX1U).t1x.bin: $(PREFIX1U).t1x
apertium-validate-transfer $<
apertium-preprocess-transfer $< $@
.deps/$(BASENAME).$(PREFIX1).cat.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py cat $< >$@
.deps/$(BASENAME).$(PREFIX1).val_gva.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py val_gva $< >$@
.deps/$(BASENAME).$(PREFIX1).val_uni.t1x: $(BASENAME).$(PREFIX1).t1x
python gent1x.py val_uni $< >$@
$(PREFIX1C).t1x: .deps/$(BASENAME).$(PREFIX1).cat.t1x
xsltproc --stringparam alt cat alt.xsl $< >$@
$(PREFIX1V).t1x: $(BASENAME).$(PREFIX1).t1x
xsltproc --stringparam alt val alt.xsl $< >$@
$(PREFIX1V).t1x: .deps/$(BASENAME).$(PREFIX1).val_gva.t1x
xsltproc --stringparam alt val_gva alt.xsl $< >$@
$(PREFIX1U).t1x: .deps/$(BASENAME).$(PREFIX1).val_uni.t1x
xsltproc --stringparam alt val_uni alt.xsl $< >$@
$(PREFIX2).t1x.bin: $(BASENAME).$(PREFIX2).t1x
apertium-validate-transfer $<
......@@ -174,10 +223,11 @@ EXTRA_DIST= \
$(BASENAME).$(PREFIX1).lrx \
$(BASENAME).$(PREFIX2).lrx \
$(BASENAME).$(PREFIX1).dix \
$(BASENAME).$(PREFIX2).dix \
$(BASENAME).$(PREFIX1).dix \
$(BASENAME).$(PREFIX1).t1x \
$(BASENAME).$(PREFIX1C).t1x \
$(BASENAME).$(PREFIX1V).t1x \
$(BASENAME).$(PREFIX1U).t1x \
$(BASENAME).$(PREFIX2).t1x \
$(BASENAME).$(LANG1).acx \
$(BASENAME).$(LANG2).acx \
......@@ -194,9 +244,10 @@ apertium_spa_catdir=$(prefix)/share/apertium/$(BASENAME)/
# Files which should be installed to $(prefix)/share/apertium/$(BASENAME)/:
apertium_spa_cat_DATA= \
$(TARGETS_COMMON) \
$(BASENAME).$(PREFIX1).t1x \
$(PREFIX1C).t1x \
$(PREFIX1V).t1x \
$(BASENAME).$(PREFIX1).t1x \
$(PREFIX1U).t1x \
$(BASENAME).$(PREFIX2).t1x
modes/$(PREFIX1).mode: modes.xml
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,4 +28,21 @@
<select lemma="cort" />
</match>
</rule>
<rule weight="1.0">
<match lemma="número"/>
<match lemma="uno" tags="num.*">
<select lemma="u" />
</match>
</rule>
<rule weight="0.1">
<match lemma="uno" tags="num.*">
<select lemma="un" />
</match>
</rule>
<rule weight="1.0">
<match lemma="orden">
<select lemma="orde" />
</match>
<match lemma="jesuita" />
</rule>
</rules>
......@@ -77,6 +77,15 @@
</def-cat>
<def-cat n="prnpro">
<cat-item lemma="lo" tags="prn.pro.p3.m.sg"/>
<cat-item lemma="lo" tags="prn.pro.p3.f.sg"/>
<cat-item lemma="lo" tags="prn.pro.p3.m.pl"/>
<cat-item lemma="lo" tags="prn.pro.p3.f.pl"/>
</def-cat>
<def-cat n="verb">
<cat-item tags="vblex.*"/>
<cat-item tags="vbser.*"/>
......@@ -174,10 +183,6 @@
<def-cat n="porque">
<cat-item lemma="porque" tags="cnjadv"/>
</def-cat>
<def-cat n="noobstante">
<cat-item lemma="no obstante2" tags="cnjadv"/>
</def-cat>
<def-cat n="cnjcoo">
<cat-item tags="cnjcoo"/>
</def-cat>
......@@ -281,6 +286,30 @@
<def-cat n="sent">
<cat-item tags="sent"/>
</def-cat>
<def-cat n="recién">
<cat-item lemma="recién" tags="adv" />
</def-cat>
<def-cat n="divulgado">
<cat-item lemma="divulgar" tags="vblex.pp.*" />
</def-cat>
<def-cat n="recién_participi">
<cat-item tags="vblex.pp.*" />
<!--
<cat-item lemma="pintar" tags="vblex.pp.*" />
<cat-item lemma="hacer" tags="vblex.pp.*" />
<cat-item lemma="estrenar" tags="vblex.pp.*" />
<cat-item lemma="comprar" tags="vblex.pp.*" />
<cat-item lemma="lavar" tags="vblex.pp.*" />
<cat-item lemma="planchar" tags="vblex.pp.*" />
<cat-item lemma="prensar" tags="vblex.pp.*" />
<cat-item lemma="cocinar" tags="vblex.pp.*" />
<cat-item lemma="preparar" tags="vblex.pp.*" />
<cat-item lemma="tender" tags="vblex.pp.*" />
-->
</def-cat>
</section-def-cats>
......@@ -8225,7 +8254,7 @@
</rule>
<rule alt="val"> <!-- REGLA: els del servei lingüístic UA volen que tradueixi 'podían y debían' per 'podien i devien' en comptes de 'podien i havien de'-->
<rule alt="val_uni val_gva"> <!-- REGLA: els del servei lingüístic UA volen que tradueixi 'podían y debían' per 'podien i devien' en comptes de 'podien i havien de'-->
<pattern>
<pattern-item n="poder"/>
<pattern-item n="cnjcoo"/>
......@@ -8252,7 +8281,7 @@
</action>
</rule>
<rule alt="val"> <!-- REGLA: els del servei lingüístic UA volen que tradueixi 'dilluns + de + matí'-->
<rule alt="val_gva val_uni"> <!-- REGLA: els del servei lingüístic UA volen que tradueixi 'dilluns + de + matí'-->
<pattern>
<pattern-item n="dies"/>
<pattern-item n="matitarda"/>
......@@ -8302,6 +8331,87 @@
<rule alt="val_gva"> <!-- pronom + haver + participi concordats: las ha comprado = les ha comprades-->
<pattern>
<pattern-item n="prnpro"/>
<pattern-item n="haber"/>
<pattern-item n="pp_nohaber"/>
</pattern>
<action>
<out>
<lu>
<clip pos="1" side="tl" part="whole"/>
</lu>
<b pos="1"/>
<lu>
<clip pos="2" side="tl" part="whole"/>
</lu>
<b pos="2"/>
<lu>
<clip pos="3" side="tl" part="lemh"/>
<clip pos="3" side="tl" part="a_verb"/>
<clip pos="3" side="tl" part="temps"/>
<clip pos="1" side="tl" part="gen"/>
<clip pos="1" side="tl" part="nbr"/>
<clip pos="3" side="tl" part="lemq"/>
</lu>
</out>
</action>
</rule>
<rule> <!-- REGLA: recién divulgado -> divulgat recentment -->
<pattern>
<pattern-item n="recién" />
<pattern-item n="divulgado" />
</pattern>
<action>
<out>
<lu>
<clip pos="2" side="tl" part="lemh"/>
<clip pos="2" side="tl" part="a_verb"/>
<clip pos="2" side="tl" part="temps"/>
<clip pos="2" side="tl" part="gen"/>
<clip pos="2" side="tl" part="nbr"/>
<clip pos="2" side="tl" part="lemq"/>
</lu>
<b pos="1"/>
<lu>
<clip pos="1" side="tl" part="lem"/>
<clip pos="1" side="tl" part="a_adv"/>
</lu>
</out>
</action>
</rule>
<rule> <!-- REGLA: recién lavado/comprado/hecho -> acabat de llavar/comprar/fer -->
<pattern>
<pattern-item n="recién" />
<pattern-item n="recién_participi" />
</pattern>
<action>
<out>
<lu>
<lit v="acabat" />
<lit-tag v="adj"/>
<clip pos="2" side="tl" part="gen"/>
<clip pos="2" side="tl" part="nbr"/>
</lu>
<b/>
<lu>
<lit v="de" />
<lit-tag v="pr" />
</lu>
<b pos="1"/>
<lu>
<clip pos="2" side="tl" part="lemh"/>
<lit-tag v="vblex.inf" />
</lu>
</out>
</action>
</rule>
......
AC_PREREQ(2.52)
AC_INIT([Apertium Spanish-Catalan], [2.0.0], [xavi.ivars@gmail.com], [apertium-spa-cat], [http://wiki.apertium.org/wiki/Apertium-spa-cat])
AC_INIT([Apertium Spanish-Catalan], [2.1.0], [xavi.ivars@gmail.com], [apertium-spa-cat], [http://wiki.apertium.org/wiki/Apertium-spa-cat])
AM_INIT_AUTOMAKE
AC_PROG_LN_S
......
from xml.sax import handler, saxutils, make_parser
import sys
alt_other = "other"
alternative = sys.argv[1]
dixfile = sys.argv[2]
if alternative == "other":
alt_other = alt_other[::-1] # reverse string
def printAttrs(attrsmap):
if len(attrsmap) == 0:
return ""
output = []
for (i,j) in attrsmap.items():
output.append(i)
output.append("=\"")
output.append(saxutils.escape(j))
output.append("\" ")
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._buf = []
def startElement(self, name, attrs):
if "alt" in attrs:
attrs2 = {i:j for (i,j) in 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]+"/>"
self.flush()
else:
self.flush()
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"))
parser = make_parser()
parser.setContentHandler(DixHandler())
with open(dixfile, "r") as f:
parser.parse(f)
\ No newline at end of file
from xml.sax import handler, saxutils, make_parser
import sys
vr_other = "other"
alternative = sys.argv[1]
dixfile = sys.argv[2]
if alternative == "other":
vr_other = vr_other[::-1] # reverse string
def printAttrs(attrsmap):
if len(attrsmap) == 0:
return ""
output = []
for (i,j) in attrsmap.items():
output.append(i)
output.append("=\"")
output.append(saxutils.escape(j))
output.append("\" ")
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._buf = []
def startElement(self, name, attrs):
if name == "e" and "vr" in attrs:
attrs2 = {i:j for (i,j) in attrs.items() if i != "vr"}
vals = attrs["vr"].split()
if alternative in vals:
attrs2["vr"] = alternative
else:
attrs2["vr"] = vr_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]+"/>"
self.flush()
else:
self.flush()
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"))
parser = make_parser()
parser.setContentHandler(DixHandler())
with open(dixfile, "r") as f:
parser.parse(f)
\ No newline at end of file
......@@ -46,20 +46,48 @@
</program>
<program name="apertium-pretransfer"/>
<program name="lt-proc -b">
<file name="spa-cat_valencia.autobil.bin"/>
<file name="spa-cat_valencia_gva.autobil.bin"/>
</program>
<program name="lrx-proc $2">
<file name="spa-cat.autolex.bin"/>
</program>
<program name="apertium-transfer -b">
<file name="spa-cat_valencia.t1x"/>
<file name="spa-cat_valencia.t1x.bin"/>
<file name="spa-cat_valencia_gva.t1x"/>
<file name="spa-cat_valencia_gva.t1x.bin"/>
</program>
<program name="lt-proc $1">
<file name="spa-cat_valencia.autogen.bin"/>
<file name="spa-cat_valencia_gva.autogen.bin"/>
</program>
<program name="lt-proc -p">
<file name="spa-cat_valencia.autopgen.bin"/>
<file name="spa-cat_valencia_gva.autopgen.bin"/>
</program>
</pipeline>
</mode>
<mode name="spa-cat_valencia_uni" install="yes">
<pipeline>
<program name="lt-proc">
<file name="spa-cat.automorf.bin"/>
</program>
<program name="lrx-proc $2">
<file name="spa.lrx.bin"/>
</program>
<program name="apertium-tagger -g $2">
<file name="spa-cat.prob"/>
</program>
<program name="apertium-pretransfer"/>
<program name="lt-proc -b">
<file name="spa-cat_valencia_uni.autobil.bin"/>
</program>
<program name="apertium-transfer -b">
<file name="spa-cat_valencia_uni.t1x"/>
<file name="spa-cat_valencia_uni.t1x.bin"/>
</program>
<program name="lt-proc $1">
<file name="spa-cat_valencia_uni.autogen.bin"/>
</program>
<program name="lt-proc -p">
<file name="spa-cat_valencia_uni.autopgen.bin"/>
</program>
</pipeline>
</mode>
......@@ -101,7 +129,7 @@
</pipeline>
</mode>
<mode name="spa-cat-tagger" install="no">
<mode name="spa-cat-disamb" install="no">
<pipeline>
<program name="lt-proc">
<file name="spa-cat.automorf.bin"/>
......@@ -109,13 +137,10 @@
<program name="cg-proc -w">
<file name="spa-cat.rlx.bin"/>
</program>
<program name="apertium-tagger -g $2">
<file name="spa-cat.prob"/>
</program>
</pipeline>
</mode>
<mode name="spa-cat-disamb" install="no">
<mode name="spa-cat-tagger" install="no">
<pipeline>
<program name="lt-proc">
<file name="spa-cat.automorf.bin"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment