Skip to content

Instantly share code, notes, and snippets.

@xavivars
Created October 21, 2019 19:15
Show Gist options
  • Save xavivars/196f97454427c48cf12b966bc3281663 to your computer and use it in GitHub Desktop.
Save xavivars/196f97454427c48cf12b966bc3281663 to your computer and use it in GitHub Desktop.
ODT up to generation
xavi@laptop:~/src/apertium$ cat /tmp/ca-es/content.xml | ./apertium/apertium-desodt -n | sh ../apertium-spa-cat/modes/cat-spa-dgen.mode
[][<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:ooo="http:\/\/openoffice.org\/2004\/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" xmlns:dc="http:\/\/purl.org\/dc\/elements\/1.1\/" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http:\/\/openoffice.org\/2005\/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http:\/\/openoffice.org\/2004\/writer" xmlns:oooc="http:\/\/openoffice.org\/2004\/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:css3t="http:\/\/www.w3.org\/TR\/css3-text\/" xmlns:tableooo="http:\/\/openoffice.org\/2009\/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http:\/\/openoffice.org\/2010\/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:grddl="http:\/\/www.w3.org\/2003\/g\/data-view#" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http:\/\/www.w3.org\/1998\/Math\/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http:\/\/www.w3.org\/2001\/xml-events" xmlns:xforms="http:\/\/www.w3.org\/2002\/xforms" xmlns:xsd="http:\/\/www.w3.org\/2001\/XMLSchema" xmlns:xsi="http:\/\/www.w3.org\/2001\/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http:\/\/www.w3.org\/1999\/xhtml" xmlns:officeooo="http:\/\/openoffice.org\/2009\/office" office:version="1.2"><office:scripts\/><office:font-face-decls><style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="swiss"\/><style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"\/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"\/><style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="Microsoft YaHei" svg:font-family="&apos;Microsoft YaHei&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"\/><\/office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties officeooo:rsid="001c5117" officeooo:paragraph-rsid="001c5117"\/><\/style:style><\/office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"\/><text:sequence-decl text:display-outline-level="0" text:name="Table"\/><text:sequence-decl text:display-outline-level="0" text:name="Text"\/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"\/><text:sequence-decl text:display-outline-level="0" text:name="Figure"\/><\/text:sequence-decls><text:p text:style-name="P1">]Estoy probando que tal funciona ~la traducción con LibreOffice.[][<\/text:p><\/office:text><\/office:body><\/office:document-content>]
xavi@laptop:~/src/apertium$ cat /tmp/ca-es/content.xml | ./apertium/apertium-desodt -n | sh ../apertium-spa-cat/modes/cat-spa-pgen.mode
[][<?xml versionE="1.0" encoding=r"UTF-8"?>
<officre:document-conteont xmlns:meta="urrn:oasis:names:t:c:opendocument:x mlns:meta:1.0" xMmlns:office="urna:oasis:names:tc:lopendocument:xmlfns:office:1.0" xomlns:draw="urn:orasis:names:tc:opmendocument:xmlnse:drawing:1.0" xmdlns:ooo="http:\/ \/openoffice.orgi\/2004\/office" nxmlns:fo="urn:oapsis:names:tc:opeundocument:xmlns:txsl-fo-compatibl e:1.0" xmlns:xlisnk="http:\/\/wwwt.w3.org\/1999\/xrlink" xmlns:dc="ehttp:\/\/purl.orag\/dc\/elements\m/1.1\/" xmlns:st.yle="urn:oasis:names:tc:opendocu*** stack smashing detected ***: <unknown> terminated
ment:xmlns:styleAborted (core dumped)
:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http:\/\/openoffice.org\/2005\/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http:\/\/openoffice.org\/2004\/writer" xmlns:oooc="http:\/\/openoffice.org\/2004\/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:css3t="http:\/\/www.w3.org\/TR\/css3-text\/" xmlns:tableooo="http:\/\/openoffice.org\/2009\/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http:\/\/openoffice.org\/2010\/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:grddl="http:\/\/www.w3.org\/2003\/g\/data-view#" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http:\/\/www.w3.org\/1998\/Math\/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http:\/\/www.w3.org\/2001\/xml-events" xmlns:xforms="http:\/\/www.w3.org\/2002\/xforms" xmlns:xsd="http:\/\/www.w3.org\/2001\/XMLSchema" xmlns:xsi="http:\/\/www.w3.org\/2001\/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http:\/\/www.w3.org\/1999\/xhtml" xmlns:officeooo="http:\/\/openoffice.org\/2009\/office" office:version="1.2"><office:scripts\/><office:font-face-decls><style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="swiss"\/><style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"\/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"\/><style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="Microsoft YaHei" svg:font-family="&apos;Microsoft YaHei&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"\/><\/office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties officeooo:rsid="001c5117" officeooo:paragraph-rsid="001c5117"\/><\/style:style><\/office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"\/><text:sequence-decl text:display-outline-level="0" text:name="Table"\/><text:sequence-decl text:display-outline-level="0" text:name="Text"\/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"\/><text:sequence-decl text:display-outline-level="0" text:name="Figure"\/><\/text:sequence-decls><text:p text:style-name="P1">]
xavi@laptop:~/src/apertium$ cat ../apertium-spa-cat/modes/cat-spa-pgen.mode
lt-proc -w '/home/xavi/src/apertium-spa-cat/cat-spa.automorf.bin' | cg-proc -w '/home/xavi/src/apertium-spa-cat/cat-spa.rlx.bin' | apertium-tagger -g $2 '/home/xavi/src/apertium-spa-cat/cat-spa.prob' | apertium-pretransfer| lt-proc -b '/home/xavi/src/apertium-spa-cat/cat-spa.autobil.bin' | lrx-proc -m '/home/xavi/src/apertium-spa-cat/cat-spa.autolex.bin' | apertium-transfer -b '/home/xavi/src/apertium-spa-cat/apertium-spa-cat.cat-spa.t1x' '/home/xavi/src/apertium-spa-cat/cat-spa.t1x.bin' | lt-proc $1 '/home/xavi/src/apertium-spa-cat/cat-spa.autogen.bin' | lt-proc -p '/home/xavi/src/apertium-spa-cat/cat-spa.autopgen.bin'
@unhammer
Copy link

Can you reproduce it with sending the plain input to lt-proc -p? I tried copy-pasting your dgen output, can't get it to crash:


$ echo '[][<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:ooo="http:\/\/openoffice.org\/2004\/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" xmlns:dc="http:\/\/purl.org\/dc\/elements\/1.1\/" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http:\/\/openoffice.org\/2005\/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http:\/\/openoffice.org\/2004\/writer" xmlns:oooc="http:\/\/openoffice.org\/2004\/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:css3t="http:\/\/www.w3.org\/TR\/css3-text\/" xmlns:tableooo="http:\/\/openoffice.org\/2009\/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http:\/\/openoffice.org\/2010\/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:grddl="http:\/\/www.w3.org\/2003\/g\/data-view#" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http:\/\/www.w3.org\/1998\/Math\/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http:\/\/www.w3.org\/2001\/xml-events" xmlns:xforms="http:\/\/www.w3.org\/2002\/xforms" xmlns:xsd="http:\/\/www.w3.org\/2001\/XMLSchema" xmlns:xsi="http:\/\/www.w3.org\/2001\/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http:\/\/www.w3.org\/1999\/xhtml" xmlns:officeooo="http:\/\/openoffice.org\/2009\/office" office:version="1.2"><office:scripts\/><office:font-face-decls><style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="swiss"\/><style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"\/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"\/><style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="Microsoft YaHei" svg:font-family="&apos;Microsoft YaHei&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"\/><\/office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties officeooo:rsid="001c5117" officeooo:paragraph-rsid="001c5117"\/><\/style:style><\/office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"\/><text:sequence-decl text:display-outline-level="0" text:name="Table"\/><text:sequence-decl text:display-outline-level="0" text:name="Text"\/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"\/><text:sequence-decl text:display-outline-level="0" text:name="Figure"\/><\/text:sequence-decls><text:p text:style-name="P1">]Estoy probando que tal funciona ~la traducción con LibreOffice.[][<\/text:p><\/office:text><\/office:body><\/office:document-content>]

' |lt-proc -p cat-spa.autopgen.bin
[][<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:ooo="http:\/\/openoffice.org\/2004\/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http:\/\/www.w3.org\/1999\/xlink" xmlns:dc="http:\/\/purl.org\/dc\/elements\/1.1\/" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http:\/\/openoffice.org\/2005\/report" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http:\/\/openoffice.org\/2004\/writer" xmlns:oooc="http:\/\/openoffice.org\/2004\/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:css3t="http:\/\/www.w3.org\/TR\/css3-text\/" xmlns:tableooo="http:\/\/openoffice.org\/2009\/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http:\/\/openoffice.org\/2010\/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:grddl="http:\/\/www.w3.org\/2003\/g\/data-view#" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http:\/\/www.w3.org\/1998\/Math\/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http:\/\/www.w3.org\/2001\/xml-events" xmlns:xforms="http:\/\/www.w3.org\/2002\/xforms" xmlns:xsd="http:\/\/www.w3.org\/2001\/XMLSchema" xmlns:xsi="http:\/\/www.w3.org\/2001\/XMLSchema-instance" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xhtml="http:\/\/www.w3.org\/1999\/xhtml" xmlns:officeooo="http:\/\/openoffice.org\/2009\/office" office:version="1.2"><office:scripts\/><office:font-face-decls><style:font-face style:name="Lucida Sans1" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="swiss"\/><style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"\/><style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"\/><style:font-face style:name="Lucida Sans" svg:font-family="&apos;Lucida Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="Microsoft YaHei" svg:font-family="&apos;Microsoft YaHei&apos;" style:font-family-generic="system" style:font-pitch="variable"\/><style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"\/><\/office:font-face-decls><office:automatic-styles><style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard"><style:text-properties officeooo:rsid="001c5117" officeooo:paragraph-rsid="001c5117"\/><\/style:style><\/office:automatic-styles><office:body><office:text><text:sequence-decls><text:sequence-decl text:display-outline-level="0" text:name="Illustration"\/><text:sequence-decl text:display-outline-level="0" text:name="Table"\/><text:sequence-decl text:display-outline-level="0" text:name="Text"\/><text:sequence-decl text:display-outline-level="0" text:name="Drawing"\/><text:sequence-decl text:display-outline-level="0" text:name="Figure"\/><\/text:sequence-decls><text:p text:style-name="P1">]Estoy probando que tal funciona la traducción con LibreOffice.[][<\/text:p><\/office:text><\/office:body><\/office:document-content>]


If you can get a reproducible case where lt-proc -p crashes on some specific input, then we can narrow down that input to make it minimal and easier to debug.

@xavivars
Copy link
Author

I found what the problem is... I was actually wrong with the error (due to not using the modes properly)

It's a bug introduced in apertium/apertium@605540d#diff-81172e11cabd02a4ab9c27131519d378

I've added a PR that should fix it: apertium/apertium#60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment