Information on algorithm visible in popup window.
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@167061 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -1,18 +1,29 @@
|
|||
package org.gcube.nlphub;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.gcube.nlphub.legacy.Constants;
|
||||
import org.gcube.nlphub.legacy.JsonManager;
|
||||
import org.gcube.nlphub.nlp.NlpAsyncNerRunner;
|
||||
import org.gcube.nlphub.nlp.NlpParameter;
|
||||
import org.gcube.nlphub.nlp.RunnerCommander;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Servlet implementation class NLPHub
|
||||
|
@ -52,6 +63,70 @@ public class NLPHub extends HttpServlet {
|
|||
}
|
||||
|
||||
private void doWork(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
if(request.getParameter("getInfo") != null) {
|
||||
getAlgorithmInfo(request, response);
|
||||
}
|
||||
else {
|
||||
runAlgorithms(request, response);
|
||||
}
|
||||
}
|
||||
|
||||
private void getAlgorithmInfo(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
token = Constants.getToken(request, devMode);
|
||||
try {
|
||||
String dataMiner = request.getParameter("dataminer");
|
||||
String algId = request.getParameter("algId");
|
||||
HttpURLConnection connection = null;
|
||||
BufferedReader r = null;
|
||||
String algAbsrtact = "";
|
||||
PrintWriter writer = response.getWriter();
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
try {
|
||||
String finalUrl = "https://" + dataMiner + NlpAsyncNerRunner.WPS_DESCRIBE_PROCESS_URL + "&gcube-token=" + token;
|
||||
finalUrl += "&lang=en-US&Identifier=" + algId;
|
||||
URL url = new URL(finalUrl);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setRequestMethod("GET");
|
||||
r = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(r));
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
NodeList nListInput = doc.getElementsByTagName("ows:Abstract");
|
||||
if(nListInput.getLength() <= 0) {
|
||||
algAbsrtact = "No description.";
|
||||
writer.println(new JsonManager().getErrorJsonResponse(algAbsrtact));
|
||||
}
|
||||
else {
|
||||
Node nodeAbstract = nListInput.item(0);
|
||||
algAbsrtact = nodeAbstract.getTextContent();
|
||||
writer.println(new JsonManager().getSuccessJsonResponse("" + algAbsrtact));
|
||||
}
|
||||
writer.close();
|
||||
|
||||
} catch (Exception x) {
|
||||
logger.error(x.getLocalizedMessage());
|
||||
writer.println(new JsonManager().getErrorJsonResponse("" + x.getLocalizedMessage()));
|
||||
writer.close();
|
||||
} finally {
|
||||
try {
|
||||
if (r != null)
|
||||
r.close();
|
||||
if (connection != null)
|
||||
connection.disconnect();
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception x) {
|
||||
logger.error(x.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void runAlgorithms(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||
token = Constants.getToken(request, devMode);
|
||||
try {
|
||||
String dataMiner = request.getParameter("dataminer");
|
||||
|
@ -68,8 +143,8 @@ public class NLPHub extends HttpServlet {
|
|||
commander.startProcess();
|
||||
|
||||
} catch (Exception x) {
|
||||
x.printStackTrace();
|
||||
logger.error(x.getLocalizedMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,27 @@
|
|||
margin-right: 15px !important;
|
||||
}
|
||||
|
||||
.alg-info-p {
|
||||
float:left;
|
||||
margin-left: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.alg-info-p:hover {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.alg-info-p::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.alg-info {
|
||||
width: 18px;
|
||||
heigth: auto;
|
||||
}
|
||||
|
||||
.my-textarea {
|
||||
border: 1px solid #555;
|
||||
-webkit-border-radius: 5px;
|
||||
|
@ -213,14 +234,41 @@ select {
|
|||
border: solid 1px gray;
|
||||
padding: 10px;
|
||||
background: white;
|
||||
/*width:300px;
|
||||
height:300px;*/
|
||||
margin:0 auto;
|
||||
left:50%;
|
||||
top:50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.popup-text {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
border: solid 14px #4CAF50;
|
||||
border-radius: 5px;
|
||||
background: white;
|
||||
margin:0 auto;
|
||||
left:50%;
|
||||
top:50%;
|
||||
transform: translate(-50%, -50%);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.close {
|
||||
float: right;
|
||||
/*border: solid 1px #bbbbbb;
|
||||
padding: 3px;
|
||||
text-align: center;*/
|
||||
}
|
||||
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#progress-caption {
|
||||
margin-top: 3px;
|
||||
margin-left: auto;
|
||||
|
@ -234,7 +282,7 @@ select {
|
|||
|
||||
.left-side {
|
||||
float: left;
|
||||
width: 78%;
|
||||
width: 70%;
|
||||
border: 1px solid silver;
|
||||
height: 60vh;
|
||||
margin: 2px;
|
||||
|
@ -242,7 +290,7 @@ select {
|
|||
|
||||
.right-side {
|
||||
float: left;
|
||||
width: 20%;
|
||||
width: 29%;
|
||||
border: 1px solid silver;
|
||||
height: 60vh;
|
||||
margin: 2px;
|
||||
|
|
After Width: | Height: | Size: 6.5 KiB |
|
@ -144,6 +144,11 @@
|
|||
</div>
|
||||
<div id="progress-caption">In progress</div>
|
||||
</div>
|
||||
|
||||
<div class="popup-text">
|
||||
<span class="close">×</span>
|
||||
<div class="popup-text-content"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,7 @@ var appRoot = ".";
|
|||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
$(document).ready(function() {
|
||||
$(".popup-text").hide();
|
||||
disableExecuteButton();
|
||||
showAnnotationsList();
|
||||
checkInputLink();
|
||||
|
@ -220,11 +221,13 @@ setEventListeners = function() {
|
|||
});
|
||||
|
||||
window.addEventListener('contextmenu', function(e) {
|
||||
//alert("You've tried to open context menu"); //here you draw your own menu
|
||||
//e.preventDefault();
|
||||
enableDisableTextArea();
|
||||
}, false);
|
||||
|
||||
$(".popup-text").click(function(e) {
|
||||
hidePopupText();
|
||||
});
|
||||
|
||||
$("#execute-button")
|
||||
.click(
|
||||
function() {
|
||||
|
@ -274,8 +277,6 @@ setEventListeners = function() {
|
|||
$("#file-info").empty();
|
||||
}
|
||||
});
|
||||
//}
|
||||
//else runAlgorithm();
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -333,6 +334,7 @@ backHandler = function() {
|
|||
if($("#ner-ui").is(":visible"))
|
||||
return;
|
||||
$("#ner-result-container").hide();
|
||||
$(".popup-text").hide();
|
||||
$("#ner-ui").show();
|
||||
if(publicLink != null) {
|
||||
enableExecuteButton();
|
||||
|
@ -757,9 +759,10 @@ buildAlgortihmList = function() {
|
|||
$("#algorithm-params-div").empty();
|
||||
|
||||
for (var i = 0; i < jsonContent.output.result.length; i++) {
|
||||
var cb = "<p><input type='checkbox' name='foo-ner-algs' checked named='"
|
||||
var cb = "<div class='alg-info-p'><input type='checkbox' name='foo-ner-algs' checked named='"
|
||||
+ jsonContent.output.result[i].algorithm + "' id='algorithm" + i + "'>";
|
||||
cb += "<label for='algorithm" + i + "'>" + findNameByAlgorithmId(jsonContent.output.result[i].algorithm) +"</label></p>";
|
||||
cb += "<label class='label-alg-info' for='algorithm" + i + "'></label></div>";
|
||||
cb += "<div class='alg-info-p' onclick='getAlgInformation(\"" + jsonContent.output.result[i].algorithm + "\")'>" +findNameByAlgorithmId(jsonContent.output.result[i].algorithm) + "</div><div class='clearfix'></div>";
|
||||
$("#algorithm-params-div").append(cb);
|
||||
|
||||
}
|
||||
|
@ -770,6 +773,54 @@ buildAlgortihmList = function() {
|
|||
});
|
||||
}
|
||||
|
||||
getAlgInformation = function(alg) {
|
||||
var algId = "";
|
||||
for(var i in algorithms) {
|
||||
if(algorithms[i].id.indexOf(alg) > 0) {
|
||||
algId = algorithms[i].id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(algId == "") {
|
||||
alert("Invalid algorithm identifier.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var parameters = "getInfo=on";
|
||||
parameters += "&dataminer=" + encodeURIComponent(dataMiner);
|
||||
parameters += "&algId=" + algId;
|
||||
|
||||
var nlphubUrl = appRoot + "/nlphub-servlet?" + parameters;
|
||||
if(gCubeToken.length > 0)
|
||||
nlphubUrl += "&gcube-token=" + gCubeToken;
|
||||
$.ajax({
|
||||
url : nlphubUrl,
|
||||
type : "GET",
|
||||
async : true,
|
||||
success : function(data, stato) {
|
||||
//alert(data.message);
|
||||
showPopupText(data.message);
|
||||
},
|
||||
error : function(richiesta, stato, errori) {
|
||||
alert("Unexpected Error. Status: " + richiesta.status);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
showPopupText = function(text) {
|
||||
$(".popup-text-content").empty();
|
||||
$(".popup-text-content").append("<p>" + text + "</p>");
|
||||
$(".popup-text").show();
|
||||
}
|
||||
|
||||
hidePopupText = function() {
|
||||
$(".popup-text-content").empty();
|
||||
$(".popup-text").hide();
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
log4j.rootLogger=DEBUG, A1
|
||||
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||
|
||||
# Print the date in ISO 8601 format
|
||||
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
|
||||
|
||||
# Print only messages of level TRACE or above in the package org.gcube
|
||||
log4j.logger.org.gcube=TRACE
|
||||
log4j.logger.org.gcube.application.framework.core.session=INFO
|
||||
log4j.logger.org.gcube.common.scope.impl.DefaultScopeProvider=ERROR
|
||||
log4j.logger.com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor=ERROR
|
|
@ -0,0 +1,8 @@
|
|||
log4j.rootLogger=INFO,stdout
|
||||
log4j.logger.com.endeca=INFO
|
||||
# Logger for crawl metrics
|
||||
log4j.logger.com.endeca.itl.web.metrics=INFO
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t[%t]\t%m%n
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE xml>
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="org.gcube" level="INFO" />
|
||||
<logger name="org.gcube.vremanagement.smartexecutor" level="TRACE" />
|
||||
<logger name="org.gcube.dataharvest" level="TRACE" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true" version="3.0">
|
||||
<display-name>NLPHub</display-name>
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
<welcome-file>index.htm</welcome-file>
|
||||
<welcome-file>index.jsp</welcome-file>
|
||||
<welcome-file>default.html</welcome-file>
|
||||
<welcome-file>default.htm</welcome-file>
|
||||
<welcome-file>default.jsp</welcome-file>
|
||||
</welcome-file-list>
|
||||
<servlet>
|
||||
<servlet-name>NLPServlet</servlet-name>
|
||||
<servlet-class>org.gcube.nlphub.NLPHub</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>NLPServlet</servlet-name>
|
||||
<url-pattern>/nlphub-servlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>NLPUploader</servlet-name>
|
||||
<servlet-class>org.gcube.nlphub.NLPUploader</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>NLPUploader</servlet-name>
|
||||
<url-pattern>/nlphub-uploader-servlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<servlet-name>NLPMapper</servlet-name>
|
||||
<servlet-class>org.gcube.nlphub.NLPMapper</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>NLPMapper</servlet-name>
|
||||
<url-pattern>/nlphub-mapper-servlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Colors</title>
|
||||
<script type="text/javascript">
|
||||
|
||||
var hexLetters = '0123456789ABCDEF';
|
||||
|
||||
enhanceColor = function(color) {
|
||||
var c = eval("0x" + color);
|
||||
var hi = Math.round(c / 16);
|
||||
if (hi < 15) {
|
||||
hi += Math.round((15 - hi) / 1.5);
|
||||
}
|
||||
if (hi > 15)
|
||||
hi = 15;
|
||||
return '' + hexLetters[hi] + hexLetters[c % 16];
|
||||
}
|
||||
|
||||
randomRGB = function() {
|
||||
var color = '';
|
||||
var couple = '';
|
||||
for (var i = 0; i < 3; i++) {
|
||||
//do {
|
||||
couple = '' + hexLetters[Math.floor(Math.random() * 10)]
|
||||
+ hexLetters[Math.floor(Math.random() * 16)];
|
||||
// for (j = 0; j < 2; j++) {
|
||||
// couple += letters[Math.floor(Math.random() * 16)];
|
||||
// }
|
||||
//} while ((255 - parseInt("0x" + couple)) < 128)
|
||||
color += couple;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
changeColor = function() {
|
||||
var color = randomRGB();
|
||||
var complemetar = 0xFFFFFF - eval("0x" + color.substring(1));
|
||||
var complement = complemetar.toString(16);
|
||||
var R = enhanceColor(complement.substring(0, 2));
|
||||
var G = enhanceColor(complement.substring(2, 4));
|
||||
var B = enhanceColor(complement.substring(4));
|
||||
complement = "#" + R + G + B;
|
||||
var span = document.getElementsByTagName("SPAN");
|
||||
span[0].setAttribute("style", "color:#" + color + "; font-weight:bold;");
|
||||
span[1].setAttribute("style", "color:#" + color + "; background:"
|
||||
+ complement + "; font-weight:bold;");
|
||||
}
|
||||
|
||||
testReplace = function() {
|
||||
var text = "<< Text between >>";
|
||||
text = text.replace(/</g, "<");
|
||||
text = text.replace(/>/g, ">");
|
||||
console.log(text);
|
||||
document.getElementById("between-text").innerHtml = text;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="testReplace()">
|
||||
<div>
|
||||
<span>TEST COLORE</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>TEST COLORE + SFONDO</span>
|
||||
</div>
|
||||
<div id="between-text">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,456 @@
|
|||
[type="checkbox"]+label {
|
||||
margin-right: 15px !important;
|
||||
}
|
||||
|
||||
.my-textarea {
|
||||
border: 1px solid #555;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 4px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 5px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.string {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.number {
|
||||
color: darkorange;
|
||||
}
|
||||
|
||||
.boolean {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.null {
|
||||
color: magenta;
|
||||
}
|
||||
|
||||
.key {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.column {
|
||||
margin-left: 1px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.half-width {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
.margin-left-10px {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.margin-right-10px {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.clearfix::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.fixed-height {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.margin-3 {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.text-align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.text-align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
float: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.align-left-33 {
|
||||
float: right;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
.centered {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.vscrollable {
|
||||
height: 220px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ajax-file-upload {
|
||||
float: left;
|
||||
margin: 10px;
|
||||
color: white;
|
||||
background-color: #4CAF50; /*!important;*/
|
||||
padding: 0.6rem;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#execute-button {
|
||||
margin: 10px;
|
||||
color: white;
|
||||
padding: 0.6rem;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.green-button {
|
||||
margin: 10px;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 0.6rem;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#reset-upload {
|
||||
color: white;
|
||||
background-color: #4CAF50;
|
||||
padding: 0.2rem;
|
||||
text-transform: uppercase;
|
||||
vertical-align: middle;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ajax-file-upload-statusbar {
|
||||
height: 1.3em;
|
||||
width: 100% !important;
|
||||
/*display: none !important;*/
|
||||
}
|
||||
|
||||
.ajax-upload-dragdrop {
|
||||
float: right;
|
||||
border: solid 1px #dfdfdf;
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
#file-info {
|
||||
/*float: right;
|
||||
margin-left: 10px;*/
|
||||
}
|
||||
|
||||
.ajax-file-upload-progress {
|
||||
height: 2em !important;
|
||||
}
|
||||
|
||||
.full-width-bar {
|
||||
width: 100%;
|
||||
border-bottom: solid 1px gray;
|
||||
}
|
||||
|
||||
.title-box {
|
||||
width: 69%;
|
||||
float: right;
|
||||
padding-left: 3em;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#logo-image {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ajax-file-upload-container {
|
||||
display: none !important;
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
select {
|
||||
display: block;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.hidden-div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-circular-div {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
border: solid 1px gray;
|
||||
padding: 10px;
|
||||
background: white;
|
||||
/*width:300px;
|
||||
height:300px;*/
|
||||
margin:0 auto;
|
||||
left:50%;
|
||||
top:50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
#progress-caption {
|
||||
margin-top: 3px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.float-right-div {
|
||||
float: right;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.left-side {
|
||||
float: left;
|
||||
width: 78%;
|
||||
border: 1px solid silver;
|
||||
height: 60vh;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.right-side {
|
||||
float: left;
|
||||
width: 20%;
|
||||
border: 1px solid silver;
|
||||
height: 60vh;
|
||||
margin: 2px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#ner-result-accordion {
|
||||
height: 60vh;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
.left-side-half {
|
||||
float: left;
|
||||
width: 49%;
|
||||
height: 3vh;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
.right-side::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
|
||||
.left-side-half::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
|
||||
|
||||
.header-side {
|
||||
float: left;
|
||||
width: 100%;
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 4vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width: 600px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 4vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 430px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 6vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width: 430px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 6vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 300px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 8vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width: 300px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 8vh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 250px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 10vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (width: 250px) {
|
||||
.left-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.right-side {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.left-side-half {
|
||||
height: 10vh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#algorithm-param_div {
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
#result-text-div {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#result-params-div {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.collapsible-body {
|
||||
padding-left: 2px !important;
|
||||
padding-right: 2px !important;
|
||||
}
|
||||
|
||||
.collapsible-header {
|
||||
color: white;
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
/*
|
||||
input[type="checkbox"]:not(:checked){
|
||||
position: unset !important;
|
||||
opacity: unset !important;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
input[type="checkbox"]:checked {
|
||||
position: unset !important;
|
||||
opacity: unset !important;
|
||||
padding: 3px;
|
||||
}
|
||||
*/
|
||||
|
||||
.input-field label {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.collapsible {
|
||||
-webkit-box-shadow: none !important;
|
||||
-moz-box-shadow: none !important;;
|
||||
box-shadow: none !important;;
|
||||
}
|
||||
/*
|
||||
#result-params-div input[type="checkbox"]:not(:checked){
|
||||
position: unset !important;
|
||||
opacity: unset !important;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
#result-params-div input[type="checkbox"]:checked {
|
||||
position: unset !important;
|
||||
opacity: unset !important;
|
||||
padding: 3px;
|
||||
}
|
||||
*/
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>External Test</title>
|
||||
<script type="text/javascript">
|
||||
externalTest = function() {
|
||||
var link = "http://data.d4science.org/SCs1TC9zdDYzYm1LSWsrWUNQdHk3MXo3YzBtWStMUEJHbWJQNStIS0N6Yz0";
|
||||
//link = "http://www.dropbox.com/s/cnyzf1bc3b5onj3/italian-text-4.txt?dl=0";
|
||||
//link = "https://goo.gl/QgT25h";
|
||||
location.href="index.jsp?input=" + encodeURIComponent(link);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="externalTest()">
|
||||
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 180 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 178 KiB |
After Width: | Height: | Size: 27 KiB |
|
@ -0,0 +1,152 @@
|
|||
<%@ page import="org.gcube.nlphub.legacy.Constants" %>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- input=http%3A%2F%2Fws1-clarind.esc.rzg.mpg.de%2Fdrop-off%2Fstorage%2F1513257926038.txt&lang=en&analysis=const-parsing -->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title>NLPHub v1.2</title>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet" />
|
||||
<!--Import materialize.css-->
|
||||
<link type="text/css" rel="stylesheet" href="css/materialize.min.css"
|
||||
media="screen,projection" />
|
||||
<link type="text/css" rel="stylesheet" href="css/custom.css" />
|
||||
<!-- jQuery library -->
|
||||
<script
|
||||
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/materialize.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.simple.websocket.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.uploadfile.min.js"></script>
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
<script type="text/javascript" src="js/merge.js"></script>
|
||||
<script type="text/javascript">
|
||||
var activePage = "Named Entity Recognition";
|
||||
var inputFile = '<%= ((request.getParameter(Constants.INPUT_FILE_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.INPUT_FILE_PARAMETER)) %>';
|
||||
var gCubeToken = '<%= ((request.getParameter(Constants.TOKEN_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.TOKEN_PARAMETER)) %>';
|
||||
var scheme = '<%= request.getScheme() %>';
|
||||
</script>
|
||||
</head>
|
||||
<body style="padding: 0 15px;">
|
||||
|
||||
<div class="logo">
|
||||
<img id="logo-image" src="img/nlphub-logo-3.png">
|
||||
</div>
|
||||
|
||||
<!-- the "main-div" contains all tabs and contents -->
|
||||
<div class="main-div">
|
||||
<!-- tabs div: each tab must refer a page div -->
|
||||
<div class="col s12">
|
||||
<ul class="tabs">
|
||||
<li class="tab col s3"><a href="#ner" onclick="activePage='Named Entity Recognition'">NER</a></li>
|
||||
<!-- <li class="tab col s3"><a href="#other" onclick="activePage='Other'">other</a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- "ner" div: contains the name entity recognizer interface -->
|
||||
<div id="ner">
|
||||
<div id="ner-ui">
|
||||
<p class="flow-text">Named Entity Recognition</p>
|
||||
<fieldset>
|
||||
<legend>Language selection</legend>
|
||||
<div class="row">
|
||||
<div class="clearfix">
|
||||
<div class="column half-width">
|
||||
<p class="margin-3 text-align-right"></p>
|
||||
</div>
|
||||
<div class="column half-width">
|
||||
<select id="language-select" class="margin-3 align-left">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Input text</legend>
|
||||
<div class="row">
|
||||
<div class="clearfix">
|
||||
<div class="column margin-right-10px">
|
||||
<p>Drag a .TXT file on the Upload box, or select a file from your PC, or paste a text.</p>
|
||||
</div>
|
||||
<div class="column margin-left-10px">
|
||||
<div class="centered full-width" id="fu-container">
|
||||
<div class="waves-effect waves-light darken-1"
|
||||
id="upload-button">Upload text file</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-field col s12">Write or paste a text in the text area (<span style="color:red;">max 4000 characters</span>)
|
||||
<textarea maxlength="4000" id="input-textarea" class="my-textarea" rows="8"
|
||||
placeholder="paste your text here"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset>
|
||||
<legend>Annotations (deselect those you don't want to be reported)</legend>
|
||||
<div class="vscrollable">
|
||||
<table id="annotations-table">
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- this is the "execute button" -->
|
||||
<div style="text-align: center; padding: 5px;">
|
||||
<a id="execute-button">Analyse</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- this is the main result container -->
|
||||
<div id="ner-result-container">
|
||||
<div id="result-header" class="header-side">
|
||||
<div class="left-side-half" id="result-header-left"></div>
|
||||
<div class="left-side-half" id="result-header-right"></div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div class="left-side" id="result-text-div"></div>
|
||||
<div class="right-side">
|
||||
<ul class="collapsible" data-collapsible="accordion" id="ner-result-accordion">
|
||||
<li>
|
||||
<div class="collapsible-header waves-effect waves-teal">Algorithms</div>
|
||||
<div class="collapsible-body" id="algorithm-params-div"></div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<div class="collapsible-header waves-effect waves-teal">Annotations</div>
|
||||
<div class="collapsible-body" id="result-params-div"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align: left;">
|
||||
<div class="green-button float-right-div" id="back-ner-ui-button">back</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end "#ner" -->
|
||||
|
||||
<div id="#other"></div>
|
||||
|
||||
<!-- this section is used only for the operation progress indicator -->
|
||||
<div class="hidden-div progress-circular-div">
|
||||
<div class="preloader-wrapper big active">
|
||||
<div class="spinner-layer spinner-blue-only">
|
||||
<div class="circle-clipper left">
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
<div class="gap-patch">
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
<div class="circle-clipper right">
|
||||
<div class="circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="progress-caption">In progress</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- end "#main-div" -->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,106 @@
|
|||
mergeSegment = function(segment1, segment2) {
|
||||
var merged = [];
|
||||
|
||||
if(segment1[0] <= segment2[0]) {
|
||||
if(segment1[1] < segment2[0]) {
|
||||
merged = [segment1, segment2];
|
||||
}
|
||||
else {
|
||||
if(segment1[1] >= segment2[1])
|
||||
merged = [segment1];
|
||||
else
|
||||
merged = [[segment1[0], segment2[1]]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(segment2[1] < segment1[0]) {
|
||||
merged = [segment2, segment1];
|
||||
}
|
||||
else {
|
||||
if(segment2[1] >= segment1[1])
|
||||
merged = [segment2];
|
||||
else
|
||||
merged = [[segment2[0], segment1[1]]];
|
||||
}
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
compareSegment = function(segment1, segment2) {
|
||||
// inclusi o coincidenti
|
||||
if((segment1[0] >= segment2[0]) && (segment1[1] <= segment2[1]))
|
||||
return 0;
|
||||
if((segment1[0] <= segment2[0]) && (segment1[1] >= segment2[1]))
|
||||
return 0;
|
||||
// esterni
|
||||
if((segment1[1] < segment2[0]) || ((segment1[0] > segment2[1])))
|
||||
return 1;
|
||||
// intersecanti
|
||||
return -1;
|
||||
}
|
||||
|
||||
compareSegments = function(s1, s2) {
|
||||
return (s1[0] - s2[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* mergeAll: merge indices
|
||||
* parameters: indices = Array of Array of indices (index = [start, end])
|
||||
* Example: indices = [[[1,2], [4,5]], [[0,5], [7,11]]];
|
||||
*/
|
||||
|
||||
mergeAll = function(indices) {
|
||||
var m = [];
|
||||
|
||||
// first of all: creates a 1-dimension array with all data
|
||||
for(var i=0; i<indices.length; i++) {
|
||||
m = m.concat(indices[i]);
|
||||
}
|
||||
|
||||
//
|
||||
// second step: sort the array
|
||||
// for our purposes a segment is 'lower than' another segment if the left value of the segment
|
||||
// is lower than the left value of the other segment. In other words:
|
||||
// [a, b] < [c, d] if a < c
|
||||
//
|
||||
m = m.sort(compareSegments);
|
||||
|
||||
var m2 = [];
|
||||
|
||||
//
|
||||
// merging procedure:
|
||||
// the procedure uses the functions:
|
||||
// [1] 'compareSegment'.
|
||||
// when two segment are equals or included compareSegment returns 0
|
||||
// when two segment are intersecting compareSegment returns -1
|
||||
// when two segment are external (no intersection) compareSegment returns 1
|
||||
//
|
||||
// [2] 'mergeSegment'
|
||||
// returns the "union" of two segments
|
||||
//
|
||||
var current = m[0];
|
||||
for(var i=0; i<m.length; i++) {
|
||||
var cfr = compareSegment(current, m[i]);
|
||||
switch(cfr) {
|
||||
case 0:
|
||||
case -1:
|
||||
// if segments are the same or intersected the result is the merged segment
|
||||
current = mergeSegment(current, m[i])[0];
|
||||
break;
|
||||
default:
|
||||
// if segments are external mergeSegment produce two segments: the first is ready to be stored in the output vector
|
||||
// the second is to be compared with others
|
||||
var s = mergeSegment(current, m[i]);
|
||||
m2[m2.length] = s[0];
|
||||
current = s[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(m2.length == 0) {
|
||||
m2[0] = current;
|
||||
}
|
||||
else if((current[0] != m2[m2.length-1][0]) || (current[1] != m2[m2.length-1][1]))
|
||||
m2[m2.length] = current;
|
||||
return m2;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Merge TEST</title>
|
||||
<script type="text/javascript" src="js/merge.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var indices = [
|
||||
[[0,5], [7,9], [15,19]],
|
||||
[[6,10]],
|
||||
[[1,6], [9,16], [21,23]],
|
||||
[[7,9], [12,13]]
|
||||
];
|
||||
|
||||
//var newIndices = mergeIndices(indices);
|
||||
|
||||
//console.log(newIndices);
|
||||
// answer is: [0,19], [21,23]
|
||||
|
||||
indices1 = [
|
||||
[[7,19], [21,25]],
|
||||
[[1,5], [18,22]]
|
||||
];
|
||||
//answer is: [1,5], [7,25]
|
||||
|
||||
indices2 = [
|
||||
[[7,16], [21,25]],
|
||||
[[1,5], [18,22]]
|
||||
];
|
||||
//answer is: [1,5], [7,16], [18,25]
|
||||
|
||||
indices3 = [
|
||||
[[7,16], [21,25]],
|
||||
[[1,5], [18,22]],
|
||||
[[2,30]]
|
||||
];
|
||||
//answer is: [1,30]
|
||||
|
||||
indices4 = [
|
||||
[[1,4], [5, 8], [21,25]],
|
||||
[[1,5], [18,22]],
|
||||
[[0,2], [11,15], [27,31]]
|
||||
];
|
||||
//answer is: [0,8],[11,15],[18,25],[27,31]
|
||||
|
||||
var indices = indices4;
|
||||
var mm = mergeAll(indices);
|
||||
|
||||
console.log(mm);
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,5 +1,5 @@
|
|||
#Generated by Maven
|
||||
#Tue Mar 27 17:00:52 CEST 2018
|
||||
#Wed Apr 11 13:35:30 CEST 2018
|
||||
version=0.0.1-SNAPSHOT
|
||||
groupId=org.gcube
|
||||
artifactId=nlphub
|
||||
|
|
|
@ -15,6 +15,7 @@ var checkedAnnotation = "";
|
|||
var algIndexedArray = [];
|
||||
var computedLanguage = "";
|
||||
var dataMiner = "";
|
||||
var appRoot = ".";
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// Starting point: get the csv file with algorithm parameters and set the page
|
||||
|
@ -36,8 +37,9 @@ checkInputLink = function() {
|
|||
async : true,
|
||||
success : function(data, stato) {
|
||||
freeText = data;
|
||||
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?getlang=on&freetext="
|
||||
var uploaderUrl = appRoot + "/nlphub-uploader-servlet?getlang=on&freetext="
|
||||
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
||||
|
||||
if(gCubeToken.length > 0)
|
||||
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||
$.ajax({
|
||||
|
@ -99,7 +101,7 @@ initApplication = function() {
|
|||
});
|
||||
|
||||
disableExecuteButton();
|
||||
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner);
|
||||
var uploaderUrl = appRoot + "/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner);
|
||||
if(gCubeToken.length > 0)
|
||||
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||
|
||||
|
@ -243,36 +245,37 @@ setEventListeners = function() {
|
|||
// must be written in the workspace and the public link
|
||||
// is set.
|
||||
if ($("#input-textarea").val().length > 0) {
|
||||
if(publicLink == null) {
|
||||
freeText = $("#input-textarea").val();
|
||||
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?freetext="
|
||||
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
||||
if(gCubeToken.length > 0)
|
||||
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||
//if(publicLink == null) {
|
||||
freeText = $("#input-textarea").val();
|
||||
var uploaderUrl = appRoot + "/nlphub-uploader-servlet?freetext="
|
||||
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
||||
|
||||
if(gCubeToken.length > 0)
|
||||
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||
|
||||
$.ajax({
|
||||
url : uploaderUrl,
|
||||
type : "POST",
|
||||
async : true,
|
||||
contentType : "text/plain; charset=utf-8",
|
||||
success : function(data, stato) {
|
||||
publicLink = data.message;
|
||||
if (publicLink == null) {
|
||||
alert("Error uploading file.");
|
||||
}
|
||||
runAlgorithm();
|
||||
},
|
||||
error : function(richiesta, stato,
|
||||
errori) {
|
||||
alert("Unexpected Error. Status: "
|
||||
+ richiesta.status);
|
||||
hideProgress();
|
||||
textAreaEnable(true);
|
||||
$("#file-info").empty();
|
||||
$.ajax({
|
||||
url : uploaderUrl,
|
||||
type : "POST",
|
||||
async : true,
|
||||
contentType : "text/plain; charset=utf-8",
|
||||
success : function(data, stato) {
|
||||
publicLink = data.message;
|
||||
if (publicLink == null) {
|
||||
alert("Error uploading file.");
|
||||
}
|
||||
});
|
||||
}
|
||||
else runAlgorithm();
|
||||
runAlgorithm();
|
||||
},
|
||||
error : function(richiesta, stato,
|
||||
errori) {
|
||||
alert("Unexpected Error. Status: "
|
||||
+ richiesta.status);
|
||||
hideProgress();
|
||||
textAreaEnable(true);
|
||||
$("#file-info").empty();
|
||||
}
|
||||
});
|
||||
//}
|
||||
//else runAlgorithm();
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -579,7 +582,7 @@ runAlgorithm = function() {
|
|||
parameters += "&plink=" + encodeURIComponent(publicLink);
|
||||
parameters += "&algs=" + algList;
|
||||
|
||||
var nlphubUrl = "/nlphub/nlphub-servlet?" + parameters;
|
||||
var nlphubUrl = appRoot + "/nlphub-servlet?" + parameters;
|
||||
if(gCubeToken.length > 0)
|
||||
nlphubUrl += "&gcube-token=" + gCubeToken;
|
||||
$.ajax({
|
||||
|
@ -627,9 +630,8 @@ getOutputJson = function(message) {
|
|||
parameters += "&plink=" + encodeURI(publicLink);
|
||||
parameters += "&lang=" + $("#language-select").val();
|
||||
parameters += "&tobemap=" + encodeURI(tobemap);
|
||||
//console.log(parameters);
|
||||
|
||||
var mapperUrl = "/nlphub/nlphub-mapper-servlet?" + parameters;
|
||||
var mapperUrl = appRoot + "/nlphub-mapper-servlet?" + parameters;
|
||||
if(gCubeToken.length > 0)
|
||||
mapperUrl += "&gcube-token=" + gCubeToken;
|
||||
|
||||
|
@ -639,7 +641,6 @@ getOutputJson = function(message) {
|
|||
async : true,
|
||||
success : function(data, stato) {
|
||||
hideProgress();
|
||||
//console.log(data);
|
||||
if ((typeof (data.response) != "undefined")
|
||||
&& (data.response.trim().toUpperCase() == "ERROR")) {
|
||||
alert("ERROR\n" + data.message);
|
||||
|
@ -1001,7 +1002,7 @@ resizeTable = function() {
|
|||
+ "\" value=\"" + annotations[i]
|
||||
+ "\" checked=\"checked\"></input> <label for=\"check-" + i
|
||||
+ "\">" + annotations[i] + "</label>";
|
||||
if(annotations[i].toLowerCase() == "keyword") {
|
||||
if((annotations[i].toLowerCase() == "keyword") || (annotations[i].toLowerCase() == "event")) {
|
||||
annotationElement = "<input type=\"checkbox\" id=\"check-" + i
|
||||
+ "\" value=\"" + annotations[i]
|
||||
+ "\"></input> <label for=\"check-" + i
|
||||
|
@ -1081,7 +1082,6 @@ buildLanguageList = function() {
|
|||
selectAnnotationsByLanguage();
|
||||
});
|
||||
|
||||
$("#language-select").change();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|