Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
  • Loading branch information
berndmoos committed Dec 8, 2024
2 parents 1c200e3 + 4fed1c8 commit c67d3f5
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 72 deletions.
24 changes: 18 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
<!-- <packaging>war</packaging> -->
<packaging>jar</packaging>
<name>ZuMultMVN</name>
<url>https://zumult.org/</url>

<!-- related to #214 -->
<repositories>
<repository>
<id>github-manual</id>
<url>https://raw.githubusercontent.com/Exmaralda-Org/exmaralda/master/src/build/webjar/</url>
</repository>
</repositories> <url>https://zumult.org/</url>
<build>
<finalName>${project.artifactId}</finalName>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
Expand All @@ -20,8 +27,12 @@
</resource>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>/data/corpora/**</exclude>
<exclude>/data/indices/**</exclude>
</excludes>
</resource>
</resources>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -68,10 +79,11 @@
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
</dependency> -->
<!-- see #214 -->
<dependency>
<groupId>org.exmaralda</groupId>
<artifactId>EXMARaLDA</artifactId>
<version>Preview-20220623</version>
<artifactId>EXMARaLDA_WEB</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
Expand Down Expand Up @@ -258,4 +270,4 @@
</plugin>
</plugins>
</reporting>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ public IDList getTranscripts4SpeechEvent(String speechEventID) throws IOExceptio
/*NodeList allTranscripts =
(NodeList) xPath.evaluate("//Transcription[substring(Filename, string-length(Filename)-3)='.exb' or substring(Filename, string-length(Filename)-3)='.EXB']",
communication.getDocument().getDocumentElement(), XPathConstants.NODESET);*/
String xpath = "//Transcription[substring(Filename, string-length(Filename)-3)='.xml' or substring(Filename, string-length(Filename)-3)='.XML']";
NodeList allTranscripts =
(NodeList) xPath.evaluate("//Transcription[substring(Filename, string-length(Filename)-3)='.xml' or substring(Filename, string-length(Filename)-3)='.XML']",
(NodeList) xPath.evaluate(xpath,
communication.getDocument().getDocumentElement(), XPathConstants.NODESET);
for (int i=0; i<allTranscripts.getLength(); i++){
Element transcriptElement = ((Element)(allTranscripts.item(i)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import org.zumult.backend.BackendInterface;
import org.zumult.backend.BackendInterfaceFactory;
import org.zumult.backend.Configuration;
import org.zumult.backend.MetadataFinderInterface;
import org.zumult.io.IOHelper;
Expand Down Expand Up @@ -51,7 +52,7 @@ private void doit() {
"--- Metadata path : " +
Configuration.getMetadataPath()
);
BackendInterface bi = new COMAFileSystem();
BackendInterface bi = new COMAFileSystem();
SearchResultPlus searchResult = bi.search("[word=\"juste\"]", null, null, "EXMARaLDA-DemoKorpus", null, 1000, null, null, null, null, null);
long t1 = System.currentTimeMillis();
KWIC kwic = bi.getKWIC(searchResult, "3-t,3-t");
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/zumult/io/isotei2html_table.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@
<xsl:variable name="lemma" select="@lemma"/>
<xsl:variable name="pos" select="@pos"/>
<xsl:variable name="trans" select="."/>
<xsl:variable name="startAnchor" select="preceding-sibling::tei:anchor[1]/@synch"/>
<xsl:variable name="endAnchor" select="following-sibling::tei:anchor[1]/@synch"/>
<!-- <xsl:variable name="startAnchor" select="preceding-sibling::tei:anchor[1]/@synch"/>
<xsl:variable name="endAnchor" select="following-sibling::tei:anchor[1]/@synch"/> -->
<xsl:variable name="startAnchor" select="preceding::tei:anchor[1]/@synch"/>
<xsl:variable name="endAnchor" select="following::tei:anchor[1]/@synch"/>
<xsl:variable name="start" select="//tei:when[@xml:id=$startAnchor]/@interval"/>
<xsl:variable name="end" select="//tei:when[@xml:id=$endAnchor]/@interval"/>
<span data-start="{$start}" data-end="{$end}" data-norm="{$norm}" data-lemma="{$lemma}" data-pos="{$pos}" data-id="{$ID}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public List<String> getTopics() {
public IDList getTranscripts() {
IDList result = new IDList("transcript");
try {
String xPathString = "descendant::Transcription";
//String xPathString = "descendant::Transcription";
String xPathString = "descendant::Transcription[substring(Filename, string-length(Filename)-3)='.xml' or substring(Filename, string-length(Filename)-3)='.XML']";
NodeList transcriptionNodeList = (NodeList) xPath.evaluate(xPathString, getDocument().getDocumentElement(), XPathConstants.NODESET);
for (int i=0; i<transcriptionNodeList.getLength(); i++){
Element transcriptionElement = (Element)(transcriptionNodeList.item(i));
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/zumult/query/implementations/COMASearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.zumult.backend.Configuration;
Expand Down Expand Up @@ -67,8 +68,22 @@ public IDList getCorporaForSearch(String searchIndex) {
@Override
public ArrayList<String> getIndexPaths(SearchIndexType searchIndex) throws IOException, SearchServiceException {
ArrayList<String> result = new ArrayList<>();
// this is for #219
String corpQ = metadataQuery.corpusQuery.replaceAll("corpusSigle=", "").replace("\"", "");
// Corpus: corpusSigle="INTV"
System.out.println("Corpus: " + corpQ);
String[] corps = (corpQ + "|").split("\\|");
Set<String> corpora = new HashSet<>();
for (String c : corps){
corpora.add(c.trim());
}

//for (String indexID : Configuration.getTranscriptBasedIndexIDs()){
for (String indexID : Configuration.getSpeakerBasedIndexIDs()){
// this is for #219
String thisCorpus = indexID.substring(indexID.indexOf("_")+1);
if (!corpora.contains(thisCorpus)) continue;

File file = new File(Configuration.getSearchIndexPath(), indexID);
result.add(file.getAbsolutePath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ public DefaultKWICSnippet apply(Document transcriptDoc,
//Node firstAnnotationBlock = (Element) xPath.evaluate(xpathString, TranscriptDoc, XPathConstants.NODE);
//Node firstAnnotationBlock = (Node) xPath.compile(xpathString).evaluate(transcriptDoc, XPathConstants.NODE);
//Node firstAnnotationBlock = (Node) firstElem.getParentNode().getParentNode().getParentNode();
Element firstAnnotationBlockElem = (Element) firstElem.getParentNode().getParentNode().getParentNode();
// This is wrong if we have nested <seg>s
//Element firstAnnotationBlockElem = (Element) firstElem.getParentNode().getParentNode().getParentNode();

String xpathString = "ancestor::tei:"+ Constants.ELEMENT_NAME_ANNOTATION_BLOCK + "[1]";
Element firstAnnotationBlockElem = (Element) xPath.evaluate(xpathString, firstElem, XPathConstants.NODE);
String speaker = firstAnnotationBlockElem.getAttribute(Constants.ATTRIBUTE_NAME_WHO);
//System.out.println("Speaker is " + speaker);
speaker = getSpeakerInitials(speaker, transcriptDoc);
// get left context
int index = 0;
Expand Down Expand Up @@ -192,10 +197,13 @@ public DefaultKWICSnippet apply(Document transcriptDoc,

private String getSpeakerInitials(String speaker, Document transcriptDoc){

String xpathString = "//tei:person[@xml:id='" + speaker + "']";
//System.out.println("Looking for " + speaker);
//Node personNode = null;
try {

// /tei:TEI/tei:teiHeader[1]/tei:profileDesc[1]/tei:particDesc[1]/tei:person[1]
String xpathString = "/tei:TEI/tei:teiHeader[1]/tei:profileDesc[1]/tei:particDesc[1]/tei:person[@xml:id='" + speaker + "']";
//String xpathString = "/tei:TEI/tei:teiHeader[1]/tei:profileDesc[1]/tei:particDesc[1]/tei:person[@xml:id='" + speaker + "']";
Element personElement = (Element) xPath.compile(xpathString).evaluate(transcriptDoc, XPathConstants.NODE);
if (personElement!=null){
return personElement.getAttribute("n");
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/resources/MessageBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DocumentsPerPage=Documents per Page
Download=Download
DownloadOptions=Download Options
DownloadKWIC=Download KWIC
EnterYourCQP=Please enter your CQP query and choose between different search modes
EnterYourCQP=Please enter your CQP query
Examples=Examples
SearchInputFieldPlaceholder=Find...
First=First
Expand Down Expand Up @@ -89,7 +89,7 @@ ViewHitsAsLemmaTable=View hits as lemma table
ViewHitsAsKWICOnTheQueryTab=View hits as KWIC on the Query-Tab
Vocabulary=Lemma and Query Lists
WordTokens=word tokens
ZuRechtSubtitle=CQP queries to the AGD corpora, using a Lucene index via MTAS
ZuRechtSubtitle=CQP queries corpora, using a Lucene index via MTAS
ReferenceWordlist=Reference wordlist
RefWordlist=Ref wordlist
WaitWordlistLoading=Please wait -- wordlist is loading.
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/resources/MessageBundle_de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Project=Projekt
Home=Startseite
Logout=Ausloggen
ZuRechtSubtitle=CQP-Suchanfragen in den Korpora des AGD
ZuRechtSubtitle=CQP-Suchanfragen in Korpora
AvailableCorpora=Korpora
Cancel=Abbrechen
InPreparation=in Vorbereitung
Expand Down Expand Up @@ -32,7 +32,7 @@ SearchBtn=Suche starten
OpenPanelWithSearchOptions=Suchoptionen \u00f6ffnen
IgnorePunctuation=Satzzeichen ignorieren
NumberOfHitsForDownload=Anzahl der Treffer f\u00fcr Download
EnterYourCQP=Bitte geben Sie Ihren CQP-Suchausdruck ein und w\u00e4hlen Sie den Suchmodus (Transkript- vs. Sprecher-basiert)
EnterYourCQP=Bitte geben Sie Ihren CQP-Suchausdruck ein
OpenHelp=Hilfe anzeigen
Loading=wird geladen...
LoadingPage=Bitte warten Sie. Die Seite wird geladen...
Expand Down
Binary file added web/images/talking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web/images/words.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions web/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

<%@page import="java.util.Locale"%>
<%@page import="java.util.ResourceBundle"%>
<%@page import="org.zumult.objects.IDList"%>
<%@page import="org.zumult.backend.BackendInterfaceFactory"%>
<%@page import="org.zumult.backend.BackendInterface"%>




<!DOCTYPE html>
Expand Down Expand Up @@ -36,7 +41,6 @@

<link rel="stylesheet" href="css/overview.css"/>

<%@include file="WEB-INF/jspf/matomoTracking.jspf" %>

<script>
$(document).ready(function(){
Expand All @@ -55,16 +59,22 @@

<%
String pageTitle = myResources.getString("testApp");
BackendInterface bi = BackendInterfaceFactory.newBackendInterface();
IDList allTranscriptIDs = bi.getTranscripts4Corpus(bi.getCorpora().get(0));
String randomTranscriptID = allTranscriptIDs.get((int)(Math.random() * (allTranscriptIDs.size())));
%>

<body style="background-image: url('./images/doors.jpg');">
<body style="background-image: url('./images/talking.png');">

<% String pageName = "ZuMult"; %>
<%@include file="../WEB-INF/jspf/zumultNav.jspf" %>
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-8" style="background:white;padding-top: 20px; border-radius: 15px;">
<div class="m-3 text-center">
<a href="./jsp/corpusoverview.jsp?lang=<%=currentLocale.getLanguage()%>" class="btn btn-outline-info" target="_blank">Corpora</a>
</div>

<div class="card-deck">
<div class="card mb-3">
Expand All @@ -80,7 +90,7 @@
<div class="card-body">
<h5 class="card-title">ZuViel</h5>
<p class="card-text"><%=myResources.getString("ZuVielShort")%></p>
<a href="./jsp/zuViel.jsp?transcriptID=ID2668D68B-60BC-E915-A7D3-68DE4A6AB954" class="btn btn-primary" target="_blank">ZuViel</a>
<a href="./jsp/zuViel.jsp?transcriptID=<%= randomTranscriptID %>" class="btn btn-primary" target="_blank">ZuViel</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/js/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getCurrentPosition(){
}

function getVideoImage(videoID){
var WEBSERVICE = "/ZumultDataServlet?command=getVideoImage"
var WEBSERVICE = "/ZumultDataServlet?command=getVideoImage";
var PARAMETERS = "&videoID=" + videoID
+ "&position=" + getCurrentPosition();
$.get(BASE_URL + WEBSERVICE + PARAMETERS, function( data ) {
Expand Down
27 changes: 9 additions & 18 deletions web/jsp/corpusoverview.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ZuMult: AGD Corpus Overview</title>
<title>ZuMult: Corpus Overview</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"/>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
Expand All @@ -69,9 +69,9 @@

</head>
<body>
<% String pageTitle = "Korpusübersicht Archiv für Gesprochenes Deutsch";
<% String pageTitle = "Korpusübersicht";
if ("en".equals(language)) {
pageTitle = "Corpus overview Archive for Spoken German";
pageTitle = "Corpus overview";
}
String pageName = "ZuMult";
%>
Expand All @@ -83,13 +83,12 @@
<div class="col-sm-8">
<p class="text-justify">
<% if ("en".equals(language)) { %>
This page gives an overview of the <%= corpora.size() %> spoken language corpora of the
<a href="http://agd.ids-mannheim.de" target="_blank">Archive for Spoken German</a>
which are available online.
This page gives an overview of the <%= corpora.size() %> corpora available in this
<a href="http://zumult.org" target="_blank">ZuMult</a> instance.
<% } else { %>
Diese Seite gibt einen Überblick über die <%= corpora.size() %> mündlichen Korpora des
<a href="http://agd.ids-mannheim.de" target="_blank">Archiv für Gesprochenes Deutsch</a>,
die online zugänglich sind.
Diese Seite gibt einen Überblick über die <%= corpora.size() %> Korpora, die in dieser
<a href="http://zumult.org" target="_blank">ZuMult</a>-Instanz
zugänglich sind.
<% } %>
</p>
</div>
Expand All @@ -112,7 +111,7 @@
<div class="row no-gutters">
<div class="col-md-2">
<figure class="figure">
<img src="../images/corpora/<%= corpusID %>.png" class="card-img-top rounded" alt="...">
<img src="../images/words.jpg" class="card-img-top rounded" alt="...">
<% if (IMAGE_COPYRIGHT_MAP.containsKey(corpusID)) { %>
<figcaption class="figure-caption text-right">&copy; <%= IMAGE_COPYRIGHT_MAP.get(corpusID) %></figcaption>
<% } %>
Expand All @@ -123,14 +122,6 @@
<h5 class="card-title"><%=acronym%></h5>
<h6 class="card-subtitle mb-2 text-muted"><%=name%></h6>
<p class="card-text"><%=description%></p>
<a class="card-link" target="_blank" href="eventstable.jsp?corpusID=<%=corpusID%>">
<%= backendInterface.getEvents4Corpus(corpusID).size() %>
<% if ("en".equals(language)) { %>
Events
<% } else { %>
Ereignisse
<% } %>
</a>
<a class="card-link" target="_blank" href="speecheventstable.jsp?corpusID=<%=corpusID%>">
<%= backendInterface.getSpeechEvents4Corpus(corpusID).size() %>
<% if ("en".equals(language)) { %>
Expand Down
3 changes: 2 additions & 1 deletion web/jsp/speecheventstable.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@
// Long dur = System.currentTimeMillis() - time;
// time = System.currentTimeMillis();
SpeechEvent speechEvent = backendInterface.getSpeechEvent(speechEventID);
String firstTranscriptID = speechEvent.getTranscripts().get(0);
%>
<tr>
<th><%=speechEventID%></th>
<th><a href="zuViel.jsp?transcriptID=<%= firstTranscriptID %>" target="_blank"><%=speechEventID%></a></th>
<%
for (MetadataKey metadataKey : metadataKeys){
String metadataValue = speechEvent.getMetadataValue(metadataKey);
Expand Down
32 changes: 0 additions & 32 deletions web/jsp/testvideo.jsp

This file was deleted.

0 comments on commit c67d3f5

Please sign in to comment.