|
|
@ -15,7 +15,7 @@ function addStopWord() {
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
stopwords.push(newsw)
|
|
|
|
stopwords.push(newsw)
|
|
|
|
$('#sweContainer').append($('<li>').attr('class', 'w3-display-container').append($('<span>').append(newsw)).append($('<span>').attr('class', 'w3-button w3-hover-red w3-transparent w3-display-right').click(function(e) {
|
|
|
|
$('#sweContainer').append($('<li>').attr('class', 'w3-display-container').append($('<span>').append(newsw)).append($('<span>').attr('class', 'w3-button w3-hover-red w3-transparent w3-display-right').click(function (e) {
|
|
|
|
var index = $(this).parent().index()
|
|
|
|
var index = $(this).parent().index()
|
|
|
|
console.log(stopwords[index])
|
|
|
|
console.log(stopwords[index])
|
|
|
|
stopwords.splice(index, 1)
|
|
|
|
stopwords.splice(index, 1)
|
|
|
@ -33,14 +33,14 @@ function addStopWord() {
|
|
|
|
function showStopwordEditor() {
|
|
|
|
function showStopwordEditor() {
|
|
|
|
console.log(stopwords)
|
|
|
|
console.log(stopwords)
|
|
|
|
$(window).unbind('keydown')
|
|
|
|
$(window).unbind('keydown')
|
|
|
|
$(window).keydown(function(event) {
|
|
|
|
$(window).keydown(function (event) {
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
addStopWord()
|
|
|
|
addStopWord()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
$('#sweContainer').empty()
|
|
|
|
$('#sweContainer').empty()
|
|
|
|
for (word of stopwords) {
|
|
|
|
for (word of stopwords) {
|
|
|
|
$('#sweContainer').append($('<li>').attr('class', 'w3-display-container').append($('<span>').append(word)).append($('<span>').attr('class', 'w3-button w3-hover-red w3-transparent w3-display-right').click(function(e) {
|
|
|
|
$('#sweContainer').append($('<li>').attr('class', 'w3-display-container').append($('<span>').append(word)).append($('<span>').attr('class', 'w3-button w3-hover-red w3-transparent w3-display-right').click(function (e) {
|
|
|
|
var index = $(this).parent().index()
|
|
|
|
var index = $(this).parent().index()
|
|
|
|
console.log(stopwords[index])
|
|
|
|
console.log(stopwords[index])
|
|
|
|
stopwords.splice(index, 1)
|
|
|
|
stopwords.splice(index, 1)
|
|
|
@ -53,7 +53,7 @@ function showStopwordEditor() {
|
|
|
|
|
|
|
|
|
|
|
|
function hideStopWordEditor() {
|
|
|
|
function hideStopWordEditor() {
|
|
|
|
$(window).unbind('keydown')
|
|
|
|
$(window).unbind('keydown')
|
|
|
|
$(window).keydown(function(event) {
|
|
|
|
$(window).keydown(function (event) {
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
if (event.keyCode == 13) {
|
|
|
|
event.preventDefault()
|
|
|
|
event.preventDefault()
|
|
|
|
sendRequest()
|
|
|
|
sendRequest()
|
|
|
@ -74,7 +74,7 @@ function submit() {
|
|
|
|
stopwords: stopwords
|
|
|
|
stopwords: stopwords
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
contentType: 'application/json',
|
|
|
|
contentType: 'application/json',
|
|
|
|
success: function(data) {
|
|
|
|
success: function (data) {
|
|
|
|
tsvPath = data.Result.path
|
|
|
|
tsvPath = data.Result.path
|
|
|
|
destroyCurrentGraph()
|
|
|
|
destroyCurrentGraph()
|
|
|
|
d3.select('#graph').append('div').attr('id', 'vis')
|
|
|
|
d3.select('#graph').append('div').attr('id', 'vis')
|
|
|
@ -102,7 +102,7 @@ function buildSentetree() {
|
|
|
|
gapBetweenGraph: 10
|
|
|
|
gapBetweenGraph: 10
|
|
|
|
});
|
|
|
|
});
|
|
|
|
tree.data(model.getRenderedGraphs(2))
|
|
|
|
tree.data(model.getRenderedGraphs(2))
|
|
|
|
new ResizeSensor(jQuery('#d3kitRoot'), function() {
|
|
|
|
new ResizeSensor(jQuery('#d3kitRoot'), function () {
|
|
|
|
var scale, origin;
|
|
|
|
var scale, origin;
|
|
|
|
scale = Math.min(2, ($('#graph').outerWidth()) / ($('#d3kitRoot').outerWidth() + 60))
|
|
|
|
scale = Math.min(2, ($('#graph').outerWidth()) / ($('#d3kitRoot').outerWidth() + 60))
|
|
|
|
|
|
|
|
|
|
|
@ -126,3 +126,10 @@ function switchMessageBox() {
|
|
|
|
$('#toggleTextBox').html('隱藏文字輸入區')
|
|
|
|
$('#toggleTextBox').html('隱藏文字輸入區')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function countWords() {
|
|
|
|
|
|
|
|
text = $("#rawTextBox").val()
|
|
|
|
|
|
|
|
let wordCount = text.split(new RegExp("[\u4e00-\u9fa5]")).length - 1
|
|
|
|
|
|
|
|
console.log(wordCount)
|
|
|
|
|
|
|
|
$("#wordcount").html('字數:' + wordCount)
|
|
|
|
|
|
|
|
}
|