From 013675386bf44a42f12d4799d3bfa12d8285d8b9 Mon Sep 17 00:00:00 2001 From: berndmoos Date: Wed, 11 Dec 2024 13:46:16 +0100 Subject: [PATCH] #226 --- .../zumult/io/Transcript2AnnotationHTML.xsl | 157 ++++++++++++++++ web/css/annotation.css | 94 ++++++++++ web/jsp/zuAnn.jsp | 174 ++++++++++++++++++ 3 files changed, 425 insertions(+) create mode 100644 src/main/java/org/zumult/io/Transcript2AnnotationHTML.xsl create mode 100644 web/css/annotation.css create mode 100644 web/jsp/zuAnn.jsp diff --git a/src/main/java/org/zumult/io/Transcript2AnnotationHTML.xsl b/src/main/java/org/zumult/io/Transcript2AnnotationHTML.xsl new file mode 100644 index 0000000..9e7446d --- /dev/null +++ b/src/main/java/org/zumult/io/Transcript2AnnotationHTML.xsl @@ -0,0 +1,157 @@ + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + + + + + + + +
+ + + + playAudioFromAnnotation() + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Original + + +
Translation + + +
ID
Token
Language
Normalisation
Lemma
POS
Phon
+
+ + + + + + id + + + + + + + trans + + + + + + + lang + + + + + + + + + + + + + + + + + + + [ + + ] + + + + +
\ No newline at end of file diff --git a/web/css/annotation.css b/web/css/annotation.css new file mode 100644 index 0000000..2550424 --- /dev/null +++ b/web/css/annotation.css @@ -0,0 +1,94 @@ +/* +Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license +Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/CascadeStyleSheet.css to edit this template +*/ +/* + Created on : 23.01.2024, 12:37:21 + Author : bernd +*/ + +table.annotations { + margin-top : 15px; + border : 3px solid gray; +} + + +table.annotations td { + white-space: nowrap; + border: 1px solid rgb(245,245,245); +} + +div.annotations-div td.numbering { + font-weight: bold; + min-width: 50px; + background: gray; + color: white; + text-align:center; +} + +div.annotations-div td.speaker { + min-width:160px; + font-weight: bold; + text-align: right; + padding-right: 10px; +} + +table.annotations td.id { + color : gray; + font-size : 8pt; +} + +table.annotations th { + text-align: right; + padding-right: 10px; +} + +table.annotations td.trans { + font-size : 15pt; + padding-right: 5px; +} + +table.annotations td.original { + background : rgb(252, 239, 169); +} + +table.annotations td.translation { + font-style : italic; +} + +table.annotations td.lang { + font-size : 8pt; +} + +table.annotations td.eng { + color: blue; +} + +table.annotations td.amb { + color: red; +} + +table.annotations td.xxx { + color: green; +} + +table.annotations td.norm { + font-size : 11pt; + padding-right: 5px; +} + +table.annotations td.lemma { + font-style : italic; + padding-right: 5px; +} + +table.annotations td.pos { + font-weight: bold; + font-size: 10pt; +} + +table.annotations td.phon { + font-size : 9pt; + font-family: monospace; +} + diff --git a/web/jsp/zuAnn.jsp b/web/jsp/zuAnn.jsp new file mode 100644 index 0000000..1839b68 --- /dev/null +++ b/web/jsp/zuAnn.jsp @@ -0,0 +1,174 @@ +<%-- + Document : zuPass + Created on : 10.12.2024, 16:31:06 + Author : bernd +--%> +<%@page import="java.util.Locale"%> +<%@page import="java.util.ResourceBundle"%> +<%@page import="org.zumult.backend.Configuration"%> +<%@page import="org.zumult.objects.Media"%> +<%@page import="java.util.ArrayList"%> +<%@page import="java.util.Arrays"%> +<%@page import="java.util.List"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@page import="org.zumult.objects.Transcript"%> +<%@page import="org.zumult.backend.BackendInterfaceFactory"%> +<%@page import="org.zumult.backend.BackendInterface"%> +<%@page import="org.zumult.io.IOHelper"%> + + + + + + +<% + BackendInterface backend = BackendInterfaceFactory.newBackendInterface(); + String transcriptID = request.getParameter("transcriptID"); + if (transcriptID==null){ + // redirect to error page + } + + String pageName = "ZuAnn"; + String pageTitle = transcriptID; + + String speechEventID = backend.getSpeechEvent4Transcript(transcriptID); + //String transcriptID = "ISO_robmus_2015_01_002"; + //String transcriptID = "IDE57E5B6C-E67B-B454-E462-4E4868C79333"; + Transcript exbTranscript = backend.getTranscript(transcriptID); + String xml = exbTranscript.toXML(); + String[][] parameters = { + }; + String html = new IOHelper().applyInternalStylesheetToString("/org/zumult/io/Transcript2AnnotationHTML.xsl", xml, parameters); + + String videoIDsParameter = request.getParameter("videoIDs"); + List videoIDs = new ArrayList<>(); + if (videoIDsParameter==null || videoIDsParameter.length()==0){ + videoIDs = backend.getVideos4SpeechEvent(speechEventID); + } else { + String[] videoIDsSplit = videoIDsParameter.split("\\|"); + videoIDs.addAll(Arrays.asList(videoIDsSplit)); + } + + String audioIDsParameter = request.getParameter("audioIDs"); + List audioIDs = new ArrayList<>(); + if (videoIDs.isEmpty() || (audioIDsParameter==null || audioIDsParameter.length()==0)){ + audioIDs = backend.getAudios4SpeechEvent(speechEventID); + } else { + String[] audioIDsSplit = audioIDsParameter.split("\\|"); + audioIDs.addAll(Arrays.asList(audioIDsSplit)); + } + + String vttURL = Configuration.getWebAppBaseURL() + "/ZumultDataServlet?command=getVTT&transcriptID=" + transcriptID; + +%> + +<%@include file="../WEB-INF/jspf/locale.jspf" %> + + + + + + + + + + + + + + + + + + <%@include file="../WEB-INF/jspf/zumultNav.jspf" %> + +
+
+ + <% + if (!audioIDs.isEmpty() && videoIDs.isEmpty()){ + %> + + <% for (int i=0; i0){ + id = "audio-" + Integer.toString(i); + } + %> + + <% + } + %> + + <% + } + %> + + <% + for (int i=0; i0){ + id = "video-" + Integer.toString(i); + } + %> + + + <% + } + %> + +
+
+ + + +
+
+
+ +
+
+
+ <%= html %> +
+
+
+ +