Skip to content

Commit

Permalink
Updates in the build script to address acoli-repo#4 and acoli-repo#7
Browse files Browse the repository at this point in the history
  • Loading branch information
max-ionov committed Apr 12, 2022
1 parent 2563003 commit b9bc488
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 14 deletions.
19 changes: 15 additions & 4 deletions stable/apertium/build-fintan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

# Path to Fintan executable
# TODO: download and install it if not set
FINTAN=`~/Projects/LiODi/fintan-backend/run.sh`
FINTAN=~/Projects/LiODi/fintan-backend/run.sh
ARQ=arq

#################
# DO NOT CHANGE #
Expand Down Expand Up @@ -106,16 +107,26 @@ for file in langs/*; do
origfile=`echo $origfile | sed s/'\\'/'\\\/'/g;`
fi;

$FINTAN -c apertium-full.json -p $SRC $SRCLANG $TGTLANG $file;
CURDIR=`pwd`
FILEDIR=`dirname $file`
SRC=`cd $FILEDIR; git config --get remote.origin.url; cd $CURDIR`
SRC=${SRC/git@github.com:/https://github.com/}

$FINTAN -c fintan/apertium-arq.json -p $SRC $SRCLANG $TGTLANG $file;
mv src_noLexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$SRCLANG.ttl
mv tgt_noLexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$TGTLANG.ttl

mv src_Lexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$SRCLANG.ttl
mv tgt_Lexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$TGTLANG.ttl

mv trans.ttl $DIR/Apertium-$srclang-${tgtlang}_TranslationSet$SRCLANG-$TGTLANG.ttl
mv tiad.tsv $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
sed -i '1d' $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
#mv tiad.tsv $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
#sed -i '1d' $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
# Temporary until Fintan bug is not fixed
$ARQ --data=$DIR/Apertium-$srclang-${tgtlang}_Lexicon$SRCLANG.ttl \
--data=$DIR/Apertium-$srclang-${tgtlang}_Lexicon$TGTLANG.ttl \
--data=$DIR/Apertium-$srclang-${tgtlang}_TranslationSet$SRCLANG-$TGTLANG.ttl \
--query=ontolex2tsv.sparql --results=TSV | grep -v '^?' > $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;

gzip $RELEASE/trans_$SRCLANG-$TGTLANG.tsv
cd $DIR;
Expand Down
19 changes: 14 additions & 5 deletions stable/apertium/build-single-dict-fintan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ file=$1
# TODO: download and install it if not set
FINTAN=~/Projects/LiODi/fintan-backend/run.sh
SRC=https://github.com/apertium/apertium-trunk.git;
ARQ=arq

echo $file
CURDIR=`pwd`
FILEDIR=`dirname $file`
SRC=`cd $FILEDIR; git config --get remote.origin.url; cd $CURDIR`
SRC=${SRC/git@github.com:/https://github.com/}

RELEASE=apertium-rdf-`date +%F`;
mkdir -p $RELEASE;
Expand All @@ -27,12 +31,17 @@ echo creating $DIR 1>&2;
mkdir -p $DIR;
origfile=`ls -l $file | sed s/'.*\-> *\.\.\/'//g;`;

$FINTAN -c apertium-full.json -p $SRC $SRCLANG $TGTLANG $file;
$FINTAN -c fintan/apertium-arq.json -p $SRC $SRCLANG $TGTLANG $file;
mv src_noLexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$SRCLANG.ttl
mv tgt_noLexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$TGTLANG.ttl

mv src_Lexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$SRCLANG.ttl
mv tgt_Lexinfo.ttl $DIR/Apertium-${srclang}-${tgtlang}_Lexicon$TGTLANG.ttl
mv src_Lexinfo.ttl $DIR/Apertium-lexinfo-${srclang}-${tgtlang}_Lexicon$SRCLANG.ttl
mv tgt_Lexinfo.ttl $DIR/Apertium-lexinfo-${srclang}-${tgtlang}_Lexicon$TGTLANG.ttl

mv trans.ttl $DIR/Apertium-$srclang-${tgtlang}_TranslationSet$SRCLANG-$TGTLANG.ttl
mv tiad.tsv $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
# mv tiad.tsv $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
# temporary fix until Fintan bug is not solved
$ARQ --data=$DIR/Apertium-$srclang-${tgtlang}_Lexicon$SRCLANG.ttl \
--data=$DIR/Apertium-$srclang-${tgtlang}_Lexicon$TGTLANG.ttl \
--data=$DIR/Apertium-$srclang-${tgtlang}_TranslationSet$SRCLANG-$TGTLANG.ttl \
--query=ontolex2tsv.sparql --results=TSV | grep -v '^?' > $RELEASE/trans_$SRCLANG-$TGTLANG.tsv;
4 changes: 3 additions & 1 deletion stable/apertium/build-single-dict.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ SAXON=saxon;
ARQ=arq;
SRC=https://github.com/apertium/apertium-trunk.git;

echo $file
CURDIR=`pwd`
FILEDIR=`dirname $file`
SRC=`cd $FILEDIR; git config --get remote.origin.url; cd $CURDIR`

RELEASE=apertium-rdf-`date +%F`;
mkdir -p $RELEASE;
Expand Down
4 changes: 4 additions & 0 deletions stable/apertium/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ RELEASE=apertium-rdf-`date +%F`;
mkdir -p $RELEASE;

for file in langs/*; do
CURDIR=`pwd`
FILEDIR=`dirname $file`
SRC=`cd $FILEDIR; git config --get remote.origin.url; cd $CURDIR`

srclang=`echo $file | sed s/'.*\/apertium-\([^\-\.]*\)-.*'/'\1'/g;`;
tgtlang=`echo $file | sed s/'.*\/apertium-[^\-\.]*-\([^\-\.]*\)\..*'/'\1'/g;`;
SRCLANG=`echo $srclang | tr [a-z] [A-Z]`; # sed s/'.*'/'\U&'/g;`; # OS X compatibility
Expand Down
11 changes: 9 additions & 2 deletions stable/apertium/dix2src-ttl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@
<xsl:text> a lime:Lexicon</xsl:text>
<xsl:text>;&#10; lime:language "</xsl:text>
<xsl:value-of select="lower-case($LANG)"/>
<xsl:text>".&#10; </xsl:text>

<xsl:text>";&#10; </xsl:text>

<xsl:text> rdfs:label "Apertium </xsl:text>
<xsl:value-of select="upper-case($LANG)"/>
<xsl:text> Lexicon"@en;&#10; </xsl:text>
<xsl:text> rdfs:comment "This is an RDF OntoLex-lemon </xsl:text>
<xsl:value-of select="upper-case($LANG)"/>
<xsl:text> lexicon that comes from the original Apertium bilingual dictionaries."@en .&#10; </xsl:text>

<xsl:for-each select="//e/p/l">
<xsl:variable name="l">
<xsl:variable name="tmp">
Expand Down
9 changes: 8 additions & 1 deletion stable/apertium/dix2tgt-ttl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@
<xsl:text> a lime:Lexicon</xsl:text>
<xsl:text>;&#10; lime:language "</xsl:text>
<xsl:value-of select="lower-case($LANG)"/>
<xsl:text>".&#10; </xsl:text>
<xsl:text>";&#10; </xsl:text>

<xsl:text> rdfs:label "Apertium </xsl:text>
<xsl:value-of select="upper-case($LANG)"/>
<xsl:text> Lexicon"@en;&#10; </xsl:text>
<xsl:text> rdfs:comment "This is an RDF OntoLex-lemon </xsl:text>
<xsl:value-of select="upper-case($LANG)"/>
<xsl:text> lexicon that comes from the original Apertium bilingual dictionaries."@en .&#10; </xsl:text>

<xsl:for-each select="//e/p/r">
<xsl:variable name="l">
Expand Down
2 changes: 1 addition & 1 deletion stable/apertium/ontolex2tsv.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lime: <http://www.w3.org/ns/lemon/lime#>
PREFIX vartrans: <http://www.w3.org/ns/lemon/vartrans#>

SELECT ?srep ?slex ?ssense ?trans ?tsense ?tlex ?turi ?trep ?pos
SELECT ?srep ?slex ?ssense ?trans ?tsense ?tlex ?trep ?pos
WHERE {
?trans vartrans:source ?ssense; vartrans:target ?tsense.
?ssense ontolex:isSenseOf ?slex.
Expand Down

0 comments on commit b9bc488

Please sign in to comment.