From 0b8e87cbfd571bd66df42be8dadd0a776503f7c1 Mon Sep 17 00:00:00 2001
From: Daniel Jettka <daniel.jettka@uni-hamburg.de>
Date: Wed, 10 Jun 2020 18:25:37 +0200
Subject: [PATCH] changed temp file extension to usas

---
 insert-usas-annotation.sh                   | 4 ++--
 usas-annotation/insert-usas-annotations.xsl | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/insert-usas-annotation.sh b/insert-usas-annotation.sh
index 3eff707..b1f0d0b 100644
--- a/insert-usas-annotation.sh
+++ b/insert-usas-annotation.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 java -jar software/saxon9he.jar usas-annotation/insert-usas-annotations.xsl -xsl:usas-annotation/insert-usas-annotations.xsl 
 
-for file in $(find corpora/ -name '*.exbu')
+for file in $(find corpora/ -name '*.usas')
 do
-  mv $file $(echo "$file" | sed -r 's|.exbu|.exb|g')
+  mv $file $(echo "$file" | sed -r 's|.usas|.exb|g')
 done
\ No newline at end of file
diff --git a/usas-annotation/insert-usas-annotations.xsl b/usas-annotation/insert-usas-annotations.xsl
index 45a58c7..78b157a 100644
--- a/usas-annotation/insert-usas-annotations.xsl
+++ b/usas-annotation/insert-usas-annotations.xsl
@@ -35,7 +35,7 @@
             <xsl:copy-of select="document(.)//*:u"/>
         </xsl:for-each>
     </xsl:variable>
-    <xsl:variable name="result-files-extension" select="'.exbu'"/>
+    <xsl:variable name="result-files-extension" select="'.usas'"/>
     
     <!-- Keys -->
     <xsl:key name="words" match="w" use="concat(../@file-ref, '#', ../@tier-category, '#', ../@speaker, '#', ../@start, '#', ../@end)"/>
@@ -49,7 +49,7 @@
             <xsl:variable name="doc" select="document($file-ref)"/>
             <!-- overwrite the document -->
             <xsl:for-each select="$doc">
-               <xsl:result-document href="{concat(replace($file-ref, '\.exb$', ''), $result-files-extension)}">
+                <xsl:result-document href="{concat(string-join(tokenize($file-ref, '\.')[position() != last()], '.'), $result-files-extension)}">
                       <xsl:apply-templates/>
                </xsl:result-document>     
             </xsl:for-each>
@@ -90,7 +90,7 @@
             </spanGrp>
         </xsl:for-each>
         
-        <xsl:message select="concat('*** Inserted USAS tier/s for speaker ', $speaker, ' in file ', base-uri())"/>
+        <xsl:message select="concat('*** Inserted USAS tier/s for speaker ', $speaker, ' in file ', concat(string-join(tokenize(base-uri(), '\.')[position() != last()], '.'), $result-files-extension))"/>
     </xsl:template>
     
     
-- 
GitLab