git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/nlphub@165401 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2754f320a5
commit
cc6b5c73c9
|
@ -6,7 +6,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
externalTest = function() {
|
externalTest = function() {
|
||||||
var link = "http://data.d4science.org/SCs1TC9zdDYzYm1LSWsrWUNQdHk3MXo3YzBtWStMUEJHbWJQNStIS0N6Yz0";
|
var link = "http://data.d4science.org/SCs1TC9zdDYzYm1LSWsrWUNQdHk3MXo3YzBtWStMUEJHbWJQNStIS0N6Yz0";
|
||||||
link = "http://www.dropbox.com/s/cnyzf1bc3b5onj3/italian-text-4.txt?dl=0";
|
//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);
|
location.href="index.jsp?input=" + encodeURIComponent(link);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -21,8 +21,10 @@
|
||||||
<script type="text/javascript" src="js/main.js"></script>
|
<script type="text/javascript" src="js/main.js"></script>
|
||||||
<script type="text/javascript" src="js/merge.js"></script>
|
<script type="text/javascript" src="js/merge.js"></script>
|
||||||
<script type="text/javascript">
|
<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 inputFile = '<%= ((request.getParameter(Constants.INPUT_FILE_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.INPUT_FILE_PARAMETER)) %>';
|
||||||
var cGubeToken = '<%= ((request.getParameter(Constants.TOKEN_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.TOKEN_PARAMETER)) %>';
|
var gCubeToken = '<%= ((request.getParameter(Constants.TOKEN_PARAMETER) == null) ? "" : "" + request.getParameter(Constants.TOKEN_PARAMETER)) %>';
|
||||||
|
var scheme = '<%= request.getScheme() %>';
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body style="padding: 0 15px;">
|
<body style="padding: 0 15px;">
|
||||||
|
@ -36,8 +38,8 @@
|
||||||
<!-- tabs div: each tab must refer a page div -->
|
<!-- tabs div: each tab must refer a page div -->
|
||||||
<div class="col s12">
|
<div class="col s12">
|
||||||
<ul class="tabs">
|
<ul class="tabs">
|
||||||
<li class="tab col s3"><a href="#ner">NER</a></li>
|
<li class="tab col s3"><a href="#ner" onclick="activePage='Named Entity Recognition'">NER</a></li>
|
||||||
<!-- <li class="tab col s3"><a href="#other">other</a></li> -->
|
<!-- <li class="tab col s3"><a href="#other" onclick="activePage='Other'">other</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ var txtFlag = true;
|
||||||
var checkedAnnotation = "";
|
var checkedAnnotation = "";
|
||||||
var algIndexedArray = [];
|
var algIndexedArray = [];
|
||||||
var computedLanguage = "";
|
var computedLanguage = "";
|
||||||
|
var dataMiner = "";
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------------
|
||||||
// Starting point: get the csv file with algorithm parameters and set the page
|
// Starting point: get the csv file with algorithm parameters and set the page
|
||||||
|
@ -34,22 +35,20 @@ checkInputLink = function() {
|
||||||
type : "GET",
|
type : "GET",
|
||||||
async : true,
|
async : true,
|
||||||
success : function(data, stato) {
|
success : function(data, stato) {
|
||||||
$("#input-textarea").val(data);
|
freeText = data;
|
||||||
freeText = $("#input-textarea").val();
|
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?getlang=on&freetext="
|
||||||
|
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
||||||
|
if(gCubeToken.length > 0)
|
||||||
|
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/nlphub/nlphub-uploader-servlet?getlang=on&freetext="
|
url : uploaderUrl,
|
||||||
+ encodeURIComponent(freeText),
|
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : true,
|
async : true,
|
||||||
contentType : "text/plain; charset=utf-8",
|
contentType : "text/plain; charset=utf-8",
|
||||||
success : function(data, stato) {
|
success : function(data, stato) {
|
||||||
//publicLink = data.message;
|
|
||||||
//if (publicLink == null) {
|
|
||||||
// alert("Error uploading file.");
|
|
||||||
//}
|
|
||||||
hideProgress();
|
hideProgress();
|
||||||
|
$("#input-textarea").val(freeText);
|
||||||
computedLanguage = data.language;
|
computedLanguage = data.language;
|
||||||
//textAreaEnable(false);
|
|
||||||
initApplication();
|
initApplication();
|
||||||
},
|
},
|
||||||
error : function(richiesta, stato,
|
error : function(richiesta, stato,
|
||||||
|
@ -64,7 +63,7 @@ checkInputLink = function() {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error : function(richiesta, stato, errori) {
|
error : function(richiesta, stato, errori) {
|
||||||
alert("Unexpected error reading from link: '" + inputFile + "'.\nStatus: " + richiesta.status + "\nClick OK to start application.");
|
alert("Unexpected error reading from link: '" + inputFile + "'.\nStatus: " + richiesta.status + " Error: " + errori + "\nClick OK to start application.");
|
||||||
hideProgress();
|
hideProgress();
|
||||||
initApplication();
|
initApplication();
|
||||||
}
|
}
|
||||||
|
@ -100,11 +99,14 @@ initApplication = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
disableExecuteButton();
|
disableExecuteButton();
|
||||||
|
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?dataminer=" + encodeURIComponent(dataMiner);
|
||||||
|
if(gCubeToken.length > 0)
|
||||||
|
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||||
|
|
||||||
$("#upload-button")
|
$("#upload-button")
|
||||||
.uploadFile(
|
.uploadFile(
|
||||||
{
|
{
|
||||||
url : "/nlphub/nlphub-uploader-servlet",
|
url : uploaderUrl,
|
||||||
fileName : "mytxtfile",
|
fileName : "mytxtfile",
|
||||||
maxFileCount : 100,
|
maxFileCount : 100,
|
||||||
multiple : false,
|
multiple : false,
|
||||||
|
@ -243,9 +245,13 @@ setEventListeners = function() {
|
||||||
if ($("#input-textarea").val().length > 0) {
|
if ($("#input-textarea").val().length > 0) {
|
||||||
if(publicLink == null) {
|
if(publicLink == null) {
|
||||||
freeText = $("#input-textarea").val();
|
freeText = $("#input-textarea").val();
|
||||||
|
var uploaderUrl = "/nlphub/nlphub-uploader-servlet?freetext="
|
||||||
|
+ encodeURIComponent(freeText) + "&dataminer=" + encodeURIComponent(dataMiner);
|
||||||
|
if(gCubeToken.length > 0)
|
||||||
|
uploaderUrl += "&gcube-token=" + gCubeToken;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/nlphub/nlphub-uploader-servlet?freetext="
|
url : uploaderUrl,
|
||||||
+ encodeURIComponent(freeText),
|
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : true,
|
async : true,
|
||||||
contentType : "text/plain; charset=utf-8",
|
contentType : "text/plain; charset=utf-8",
|
||||||
|
@ -351,6 +357,8 @@ checkLanguage = function(lang) {
|
||||||
* CSV parser
|
* CSV parser
|
||||||
*/
|
*/
|
||||||
manageCsvData = function(data) {
|
manageCsvData = function(data) {
|
||||||
|
var tokensPerLine = 8;
|
||||||
|
|
||||||
// first of all: split on the "newline" character in order to
|
// first of all: split on the "newline" character in order to
|
||||||
// get all lines.
|
// get all lines.
|
||||||
var lines = data.split("\n");
|
var lines = data.split("\n");
|
||||||
|
@ -372,14 +380,21 @@ manageCsvData = function(data) {
|
||||||
if (tokenStart == -1) {
|
if (tokenStart == -1) {
|
||||||
tokenStart = j;
|
tokenStart = j;
|
||||||
} else {
|
} else {
|
||||||
tokens[tokens.length] = line.substring(tokenStart + 1, j);
|
tokens.push(line.substring(tokenStart + 1, j));
|
||||||
tokenStart = j;
|
tokenStart = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get the new token and push it in the array
|
// get the new token and push it in the array
|
||||||
tokens[tokens.length] = line.substring(tokenStart + 1);
|
tokens.push(line.substring(tokenStart + 1));
|
||||||
lineTokens[lineTokens.length] = tokens;
|
|
||||||
|
if(tokens.length != tokensPerLine)
|
||||||
|
continue; // skip...
|
||||||
|
|
||||||
|
lineTokens.push(tokens);
|
||||||
|
var description = tokens[1].toUpperCase().trim();
|
||||||
|
if(description == "CLOUD COMPUTING")
|
||||||
|
dataMiner = tokens[2];
|
||||||
tokens = [];
|
tokens = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +409,8 @@ getAlgorithms = function(lineTokens) {
|
||||||
for (i = 0; i < lineTokens.length; i++) {
|
for (i = 0; i < lineTokens.length; i++) {
|
||||||
if ((i == 0) || (lineTokens[i].length != 8))
|
if ((i == 0) || (lineTokens[i].length != 8))
|
||||||
continue; // skip the header
|
continue; // skip the header
|
||||||
|
if (lineTokens[i][1].toUpperCase().trim() != activePage.toUpperCase())
|
||||||
|
continue;
|
||||||
if (lineTokens[i][7].trim().toUpperCase() == "OK") {
|
if (lineTokens[i][7].trim().toUpperCase() == "OK") {
|
||||||
var algName = lineTokens[i][0].trim();
|
var algName = lineTokens[i][0].trim();
|
||||||
var algDescription = lineTokens[i][1].trim();
|
var algDescription = lineTokens[i][1].trim();
|
||||||
|
@ -553,12 +570,16 @@ runAlgorithm = function() {
|
||||||
algList = algList.substring(0, algList.length - 1);
|
algList = algList.substring(0, algList.length - 1);
|
||||||
|
|
||||||
var parameters = "annotations=" + annList;
|
var parameters = "annotations=" + annList;
|
||||||
|
parameters += "&dataminer=" + encodeURIComponent(dataMiner);
|
||||||
parameters += "&lang=" + $("#language-select").val();
|
parameters += "&lang=" + $("#language-select").val();
|
||||||
parameters += "&plink=" + encodeURI(publicLink);
|
parameters += "&plink=" + encodeURIComponent(publicLink);
|
||||||
parameters += "&algs=" + algList;
|
parameters += "&algs=" + algList;
|
||||||
|
|
||||||
|
var nlphubUrl = "/nlphub/nlphub-servlet?" + parameters;
|
||||||
|
if(gCubeToken.length > 0)
|
||||||
|
nlphubUrl += "&gcube-token=" + gCubeToken;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/nlphub/nlphub-servlet?" + parameters,
|
url : nlphubUrl,
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : true,
|
async : true,
|
||||||
success : function(data, stato) {
|
success : function(data, stato) {
|
||||||
|
@ -604,8 +625,12 @@ getOutputJson = function(message) {
|
||||||
parameters += "&tobemap=" + encodeURI(tobemap);
|
parameters += "&tobemap=" + encodeURI(tobemap);
|
||||||
//console.log(parameters);
|
//console.log(parameters);
|
||||||
|
|
||||||
|
var mapperUrl = "/nlphub/nlphub-mapper-servlet?" + parameters;
|
||||||
|
if(gCubeToken.length > 0)
|
||||||
|
mapperUrl += "&gcube-token=" + gCubeToken;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/nlphub/nlphub-mapper-servlet?" + parameters,
|
url : mapperUrl,
|
||||||
type : "POST",
|
type : "POST",
|
||||||
async : true,
|
async : true,
|
||||||
success : function(data, stato) {
|
success : function(data, stato) {
|
||||||
|
|
Loading…
Reference in New Issue