more polish on the clustering dialog
git-svn-id: http://google-refine.googlecode.com/svn/trunk@260 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
6b3a20dc46
commit
0c4b79c53a
@ -55,7 +55,7 @@ public class BinningClusterer extends Clusterer {
|
|||||||
_params = new Object[1];
|
_params = new Object[1];
|
||||||
_params[0] = size;
|
_params[0] = size;
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
//Gridworks.warn("no ngram size specified, using default");
|
//Gridworks.warn("No params specified, using default");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ public class NGramFingerprintKeyer extends Keyer {
|
|||||||
static final Pattern alphanum = Pattern.compile("\\p{Punct}|\\p{Cntrl}|\\p{Space}");
|
static final Pattern alphanum = Pattern.compile("\\p{Punct}|\\p{Cntrl}|\\p{Space}");
|
||||||
|
|
||||||
public String key(String s, Object... o) {
|
public String key(String s, Object... o) {
|
||||||
int ngram_size = 1;
|
int ngram_size = 2;
|
||||||
if (o != null && o.length > 0 && o[0] instanceof Number) {
|
if (o != null && o.length > 0 && o[0] instanceof Number) {
|
||||||
ngram_size = (Integer) o[0];
|
ngram_size = (Integer) o[0];
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class kNNClusterer extends Clusterer {
|
|||||||
JSONObject params = o.getJSONObject("params");
|
JSONObject params = o.getJSONObject("params");
|
||||||
_radius = params.getDouble("radius");
|
_radius = params.getDouble("radius");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Gridworks.warn("No parameters found, using defaults");
|
//Gridworks.warn("No parameters found, using defaults");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,14 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
|||||||
|
|
||||||
var header = $('<div></div>').addClass("dialog-header").text("Cluster & Edit column " + this._columnName).appendTo(frame);
|
var header = $('<div></div>').addClass("dialog-header").text("Cluster & Edit column " + this._columnName).appendTo(frame);
|
||||||
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
|
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
|
||||||
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
|
var footer = $(
|
||||||
|
'<div class="dialog-footer">' +
|
||||||
|
'<table width="100%"><tr>' +
|
||||||
|
'<td class="left" style="text-align: left"></td>' +
|
||||||
|
'<td class="right" style="text-align: right"></td>' +
|
||||||
|
'</tr></table>' +
|
||||||
|
'</div>'
|
||||||
|
).appendTo(frame);
|
||||||
|
|
||||||
var html = $(
|
var html = $(
|
||||||
'<div>' +
|
'<div>' +
|
||||||
@ -51,7 +58,7 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
|||||||
'</td>' +
|
'</td>' +
|
||||||
'<td>' +
|
'<td>' +
|
||||||
'<div id="ngram-fingerprint-params" class="function-params hidden">' +
|
'<div id="ngram-fingerprint-params" class="function-params hidden">' +
|
||||||
'Ngram Size: <input type="text" value="1" bind="ngramSize" size="3">' +
|
'Ngram Size: <input type="text" value="2" bind="ngramSize" size="3">' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="knn-controls hidden">' +
|
'<div class="knn-controls hidden">' +
|
||||||
'<span style="margin-right: 1em">Radius: <input type="text" value="1.0" bind="radius" size="3"></span>' +
|
'<span style="margin-right: 1em">Radius: <input type="text" value="1.0" bind="radius" size="3"></span>' +
|
||||||
@ -128,9 +135,14 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
|||||||
//this._elmts.clusterButton.click(function() { self._cluster(); });
|
//this._elmts.clusterButton.click(function() { self._cluster(); });
|
||||||
//this._elmts.unclusterButton.click(function() { self._uncluster(); });
|
//this._elmts.unclusterButton.click(function() { self._uncluster(); });
|
||||||
|
|
||||||
$('<button></button>').text("Apply & Re-Cluster").click(function() { self._onApplyReCluster(); }).appendTo(footer);
|
var left_footer = footer.find(".left");
|
||||||
$('<button></button>').text("Apply & Close").click(function() { self._onApplyClose(); }).appendTo(footer);
|
$('<button></button>').text("Select All").click(function() { self._selectAll(); }).appendTo(left_footer);
|
||||||
$('<button></button>').text("Close").click(function() { self._dismiss(); }).appendTo(footer);
|
$('<button></button>').text("Deselect All").click(function() { self._deselectAll(); }).appendTo(left_footer);
|
||||||
|
|
||||||
|
var right_footer = footer.find(".right");
|
||||||
|
$('<button></button>').text("Apply & Re-Cluster").click(function() { self._onApplyReCluster(); }).appendTo(right_footer);
|
||||||
|
$('<button></button>').text("Apply & Close").click(function() { self._onApplyClose(); }).appendTo(right_footer);
|
||||||
|
$('<button></button>').text("Close").click(function() { self._dismiss(); }).appendTo(right_footer);
|
||||||
|
|
||||||
this._level = DialogSystem.showDialog(frame);
|
this._level = DialogSystem.showDialog(frame);
|
||||||
|
|
||||||
@ -175,7 +187,7 @@ FacetBasedEditDialog.prototype._renderTable = function(clusters) {
|
|||||||
|
|
||||||
var editCheck = $('<input type="checkbox" />')
|
var editCheck = $('<input type="checkbox" />')
|
||||||
.appendTo(tr.insertCell(3))
|
.appendTo(tr.insertCell(3))
|
||||||
.click(function() {
|
.change(function() {
|
||||||
cluster.edit = !cluster.edit;
|
cluster.edit = !cluster.edit;
|
||||||
});
|
});
|
||||||
if (cluster.edit) {
|
if (cluster.edit) {
|
||||||
@ -195,10 +207,10 @@ FacetBasedEditDialog.prototype._renderTable = function(clusters) {
|
|||||||
|
|
||||||
container.empty().append(table);
|
container.empty().append(table);
|
||||||
|
|
||||||
this._elmts.resultSummary.text(
|
this._elmts.resultSummary.html(
|
||||||
(clusters.length === this._clusters.length) ?
|
(clusters.length === this._clusters.length) ?
|
||||||
(this._clusters.length + " clusters found.") :
|
("<b>" + this._clusters.length + "</b> cluster" + ((this._clusters.length != 1) ? "s" : "") + " found") :
|
||||||
(clusters.length + " clusters filtered from " + this._clusters.length + " total.")
|
("<b>" + clusters.length + "</b> cluster" + ((clusters.length != 1) ? "s" : "") + " filtered from <b>" + this._clusters.length + "</b> total")
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,7 +218,7 @@ FacetBasedEditDialog.prototype._cluster = function() {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var container = this._elmts.tableContainer.html(
|
var container = this._elmts.tableContainer.html(
|
||||||
'<div style="margin: 1em; font-size: 130%; color: #888;">Loading... <img src="/images/small-spinner.gif"></div>'
|
'<div style="margin: 1em; font-size: 130%; color: #888;">Clustering... <img src="/images/small-spinner.gif"></div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
this._elmts.resultSummary.empty();
|
this._elmts.resultSummary.empty();
|
||||||
@ -233,7 +245,7 @@ FacetBasedEditDialog.prototype._updateData = function(data) {
|
|||||||
var clusters = [];
|
var clusters = [];
|
||||||
$.each(data, function() {
|
$.each(data, function() {
|
||||||
var cluster = {
|
var cluster = {
|
||||||
edit: true,
|
edit: false,
|
||||||
choices: this,
|
choices: this,
|
||||||
value: this[0].v,
|
value: this[0].v,
|
||||||
size: this.length
|
size: this.length
|
||||||
@ -262,6 +274,14 @@ FacetBasedEditDialog.prototype._updateData = function(data) {
|
|||||||
this._updateAll();
|
this._updateAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FacetBasedEditDialog.prototype._selectAll = function() {
|
||||||
|
$(".facet-based-edit-dialog-entry-table input:not(:checked)").attr('checked', true).change();
|
||||||
|
};
|
||||||
|
|
||||||
|
FacetBasedEditDialog.prototype._deselectAll = function() {
|
||||||
|
$(".facet-based-edit-dialog-entry-table input:checked").attr('checked', false).change();
|
||||||
|
};
|
||||||
|
|
||||||
FacetBasedEditDialog.prototype._onApplyClose = function() {
|
FacetBasedEditDialog.prototype._onApplyClose = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._apply(function() {
|
this._apply(function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user