X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=blobdiff_plain;f=build%2Fjs%2FWords.js;fp=build%2Fjs%2FWords.js;h=0000000000000000000000000000000000000000;hp=264d42fa9467498a7707b3801e4c0de40bc11034;hb=cd05cac37f8e63608496788fc7afa5400c18752e;hpb=1ef930b3845248379f37a6b26c826122e9f65932 diff --git a/build/js/Words.js b/build/js/Words.js deleted file mode 100644 index 264d42f..0000000 --- a/build/js/Words.js +++ /dev/null @@ -1,62 +0,0 @@ - -var Words = Collection.extend({ - constructor: function(script) { - this.base(); - forEach (script.match(WORDS), this.add, this); - this.encode(); - }, - - add: function(word) { - if (!this.exists(word)) this.base(word); - word = this.fetch(word); - word.count++; - return word; - }, - - encode: function() { - // sort by frequency - this.sort(function(word1, word2) { - return word2.count - word1.count; - }); - - eval("var a=62,e=" + Packer.ENCODE62); - var encode = e; - var encoded = new Collection; // a dictionary of base62 -> base10 - var count = this.count(); - for (var i = 0; i < count; i++) { - encoded.store(encode(i), i); - } - - var empty = function() {return ""}; - var index = 0; - forEach (this, function(word) { - if (encoded.exists(word)) { - word.index = encoded.fetch(word); - word.toString = empty; - } else { - while (this.exists(encode(index))) index++; - word.index = index++; - } - word.encoded = encode(word.index); - }, this); - - // sort by encoding - this.sort(function(word1, word2) { - return word1.index - word2.index; - }); - }, - - toString: function() { - return this.values().join("|"); - } -}, { - Item: { - constructor: function(word) { - this.toString = function() {return word}; - }, - - count: 0, - encoded: "", - index: -1 - } -});