diff --git a/static/d3.v3.min.js b/static/js/d3.v3.min.js similarity index 100% rename from static/d3.v3.min.js rename to static/js/d3.v3.min.js diff --git a/static/js/main.js b/static/js/main.js new file mode 100644 index 0000000..41567a4 --- /dev/null +++ b/static/js/main.js @@ -0,0 +1,117 @@ + (function(){ + var k = 20; // k for top-k values + + function isStopWord(w){ + return false; + if(w.match(/\d+/) != undefined){ + return true; + } + if(w.length < 3){ + return true; + } + return false; + } + + function getRandomSample(w, n){ + _limit = Math.min(n, w.length); //200 is the width of the window. + _results = []; + _repeatedNumbers = []; + //for(var i =0; i<_limit; i++){ + while(_results.length < _limit){ + number = parseInt(Math.random(0, w.length) * w.length); + if(_repeatedNumbers.indexOf(number) >= 0){ + continue; + } + _results.push(w[number]); + _repeatedNumbers.push(number); + } + return _results; + } + + function getTopK(w, k){ + _aux = w.sort(function(a, b){ + if( a.size > b.size){ + return -1; + } + if( a.size < b.size){ + return 1; + } + return 0; + + }) + _topk = []; + for(var i=0; iPreview Visualization Demo - + - - + \ No newline at end of file