<commit_before>/**
 * IndexSearch.js
 *
 * author     -->  redcrow (<NAME>)
 * create on  -->  26/08/2013
 * website    -->  na5cent.blogspot.com
 * 
 * version    -->  1.0
 * version    -->  2.0 (multiple search keyword : AND search operation)
 * 
 * License    ---> Apache License
 * Version 2.0, January 2004 (http://www.apache.org/licenses/LICENSE-2.0)
 * 
 * 
 * 
 * update 13/12/2013 : add integrate period algorithm (document : http://na5cent.blogspot.com/2013/12/integrate-period-algorithm-javascript.html)
 */

window.IndexSearch=window.IndexSearch||function(){function q(a){return f(a)||0===a.length}function p(a,b,c){if(f(a))return-1;n(b,"String")&&(a=a.toLowerCase(),b=b.toLowerCase());return b.indexOf(a,f(c)?0:c)}function u(a){return a=a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function g(a,b,c){if(!f(a)&&n(b,"Function"))for(var h in a)if(!1===b.call(c,a[h],h))return!1;return!0}function n(a,b){return Object.prototype.toString.call(a)==="[object "+b+"]"}function f(a){return n(a,
"Undefined")}function t(a){var b=0,c;for(c in a)b+=1;return b}function v(a){var b=parseFloat(a),c=parseInt(a);return 0===b-c?c:(new Number(a)).toFixed(2)}var C=function(){function a(a,b){if(!n(a,"String"))throw Error("constructor of Interface class require first argument is 'string', but is '"+typeof a+"'.");if(!n(b,"Array"))throw Error("constructor of Interface class require second argument is 'array of string', but is '"+typeof b+"'.");}function b(a,b){if(!n(a,"String"))throw Error("constructor of Interface class require second argument is 'array of string', but method index "+
b+" is not 'string', is '"+typeof a+"'.");return a}return function(c,h){if(2!==arguments.length)throw Error("constructor of Interface class require 2 arguments : Interface({string} name, {string[]} method names");a(c,h);for(var d=[],r=0;r<h.length;r++){var e=b(h[r],r);d.push(e)}this.getName=function(){return c};this.getMethods=function(){return d}}}();C.ensureImplements=function(a,b){if(2!==arguments.length)throw Error("Interface.ensureImplements require 2 arguments : Interface.ensureImplement({object} obj, {interface[]} interfaces).");
if(!n(a,"Object"))throw Error("first argument of Interface.ensureImplements is not 'object', but is '"+typeof a+"'.");if(!n(b,"Array"))throw Error("second argument of Interface.ensureImplements is not 'array of interface', but is '"+typeof b+"'.");for(var c=0;c<b.length;c++){var h=b[c];if(h.constructor!==C)throw Error("second argument of Interface.ensureImplements index "+c+" is not interface.");var d=h.getMethods(),r;for(r in d){var e=d[r];if(f(a[e]))throw Error("implementation class is not define method '"+
e+"' of Interface '"+h.getName()+"'.");if(!n(a[e],"Function"))throw Error("implementation class define '"+e+"' is not 'method', but is '"+typeof a[e]+"'.");}}};var D=function(a){var b=a.totalPosition||0,c=a.totalSentence||0,h=a.content||{nodes:{}},d=a.suggestions||[];this.getTotalPosition=function(){return b};this.getTotalSentence=function(){return c};this.getContent=function(){return h};this.getSuggestions=function(){return d}},A=function(a,b){var c=a,h=b;this.getStart=function(){return c};this.getEnd=
function(){return h};this.setStart=function(a){c=a};this.setEnd=function(a){h=a};this.equals=function(a){return a.getStart()===c&&a.getEnd()===h?!0:!1};this.toString=function(){return"period {"+c+", "+h+"}"}},B=function(){function a(){var a=[];g(h,function(e){a.push(e)});return a}function b(){d=a().sort(function(a,e){return a.getStart()===e.getStart()?a.getEnd()-e.getEnd():a.getStart()-e.getStart()})}function c(a){for(var e in d)d[e].equals(a)&&delete d[e]}var h={},d;this.addPeriod=function(a){var e;
e=a.getStart()+":"+a.getEnd();f(h[e])&&(h[e]=a);return this};this.addAllPeriods=function(a){q(a)||g(a,function(a){this.addPeriod(a)},this);return this};this.integrate=function(){b();if(1<d.length)for(var a=1;a<d.length;a++){var e=d[a-1],k=d[a];k.getStart()<e.getEnd()&&k.setStart(e.getEnd())}if(1<d.length)for(a=1;a<d.length;a++)for(e=d[a],k=a+1;k<d.length;k++){var w=d[k],m;if(m=!f(e))if(m=!f(w))if(m=w,!(m=m.getStart()>=m.getEnd())){m=w;var x=e;m=m.getStart()>=x.getStart()&&m.getEnd()<=x.getEnd()}m&&
c(w)}if(1<d.length)for(a=1;a<d.length;a++)e=d[a-1],k=d[a],f(k)||f(e)||k.getStart()!==e.getEnd()||(k.setStart(e.getStart()),c(e),a--);return d}},l=function(a){var b=a||"",c=0;this.split=function(){var a=[],d=b.split(" ");g(d,function(b){q(b)||(a.push(b),c+=1)});return a};this.getKeywordSize=function(){return c}},H=function(a){function b(a,b){var e=new B,k=new l(b);g(k.split(),function(b){if(q(b))return!0;for(var m=b.length,k=0,c=0;;){c=p(b,a,c);if(-1===c)break;k=c;c+=m;e.addPeriod(new A(k,c))}});return e.integrate()}
var c=0,h=0;this.getTotalSentence=function(){return c};this.resetTotalSentence=function(){c=0};this.getTotalHighlight=function(){return h};this.resetTotalHighlight=function(){h=0};this.resetTotal=function(){c=h=0};this.highlight=function(d,f){c+=1;var e=u(f),k=b(e,d),w=0;g(k,function(b){var k=b.getStart()+w,c=b.getEnd()+w;b=e.substring(0,k);var k=e.substring(k,c),d='<span class="'+a+'">'+k+"</span>",c=e.substring(c);e=b+d+c;w=w+d.length-k.length;h+=1});return e}},I=new C("IndexStore",["writeIndex",
"readIndex","addDictionary","getDictionaries","getIndexs"]),J=function(a){function b(a,b){var w=c(a);return h(w,b)}function c(a){var b={};g(a,function(a){g(a,function(a){f(b[a])&&(b[a]=0);b[a]+=1})});return b}function h(a,b){var c=[];g(a,function(a,e){a>=b&&c.push(e)});return c}var d=a;if(f(d)||1>d)d=1;var r=[];for(a=1;a<=d;a++)r[a]={};this.writeIndex=function(a,b){f(b)||g(r,function(c){g(c,function(c){g(c,function(c,d){-1!==p(d,b)&&-1===p(a,c)&&c.push(a)})})})};this.readIndex=function(a){var c={};
a=new l(a);g(a.split(),function(a){g(this.getDictionaries(a),function(b,e){-1!==p(a,e)&&(f(c[a])&&(c[a]={}),g(b,function(b){c[a][b]=b}))})},this);return b(c,a.getKeywordSize())};this.addDictionary=function(a){a=a.trim().toLowerCase();q(a)||g(r,function(b,c){if(a.length>=c){var d=a.substring(0,c);f(b[d])&&(b[d]={});f(b[d][a])&&(b[d][a]=[])}})};this.getDictionaries=function(a){if(q(a))return{};a=new l(a);var b={};g(a.split(),function(a){var c=b;a.length<=d?a=r[a.length][a]:(a=a.substring(0,d),a=r[d][a]);
for(var e in a)c[e]=a[e]});f(b)&&(b={});return b};this.getIndexs=function(){return r}},K=function(a){this.writeIndex=function(b,c){a.writeIndex(b,c)};this.addDictionary=function(b){a.addDictionary(b)}},L=function(a){this.readIndex=function(b){return a.readIndex(b)};this.getDictionaries=function(b){return a.getDictionaries(b)};this.getIndexs=function(){return a.getIndexs()}},M=function(a){function b(a){for(var b={},c=0;c<a.length;c++){var d=a.charAt(c);f(b[d])&&(b[d]={duplicate:0,position:0});b[d].duplicate+=
1;b[d].position+=c}return b}function c(a,c){var m=[],r=(new l(a)).split();g(r,function(r){return g(h,function(h,g){var l;a:{l=m;for(var n in l)if(l[n].word===g){l=!0;break a}l=!1}if(!l){n=b(r);var y,p=b(g);l=0;for(y in n){f(p[y])&&(p[y]={duplicate:0,position:0});var s=n[y],z=p[y],s=s.duplicate+s.position,z=z.duplicate+z.position;if(0!==s&&0!==z){var x=(z+s)/2;l=s>=z?l+z/x:l+s/x}}y=(t(n)+t(p))/2;y=l/y*100;if(y>=c&&(l=d.highlight(a,g),q(l)&&(l=g),m.push({keywordMatch:r,word:g,highlight:l,percent:v(y)}),
m.length===e))return!1}})});return m=m.sort(function(a,b){return b.percent-a.percent})}var h=a.dictionary,d=a.highlighter,r=a.percentSuggest||60,e=a.suggestionsSize||10;this.getSuggestionsWhenSearchFound=function(a){return c(a,0)};this.getSuggestionsWhenSearchNotFound=function(a){return c(a,r)}};return function(a){function b(){for(var a in G)u.addDictionary(G[a]);c(m);for(var b in m.nodes)h(0,b,m.nodes[b]);for(var d in z)delete z[d]}function c(a){for(var b in x){var d=a[x[b]];if(!q(d)){var d=N(d),
e=void 0;for(e in d)u.addDictionary(d[e])}}a=a.nodes;if(!q(a))for(var f in a)c(a[f])}function h(a,b,c){d(c,function(a){u.writeIndex(b,a)});c.level="level-"+a;c.index=b+"";c=c.nodes;if(!q(c))for(var e in c)h(a+1,b+B+e,c[e])}function d(a,b){for(var c in x){var d=x[c],e=z[d];f(e)&&(e={},z[d]=e);var h=e[a[d]];f(h)&&(h=!0,e[a[d]]=h,b(a[d]))}}function r(){var a={};g(E,function(b){var c=b.word[0];f(a[c])&&(a[c]=[]);a[c].push(b.word)});var b=(new l(s)).split();g(a,function(a){a=a[0];for(var c in b){var d=
b[c];d[0]===a[0]&&(a.length<d.length||-1===p(d,a))&&(b[c]=a)}});e(b);return k(b)}function e(a){var b=[];g(a,function(a){g(E,function(c){a===c.word||-1!==p(c,b)||b.push(c)})});E=b}function k(a){var b={},c;for(c in a)b[a[c]]=a[c];a=[];for(var d in b)a.push(d);return a.join(" ")}function w(){return new D({totalPosition:t.getTotalHighlight(),totalSentence:t.getTotalSentence(),content:F,suggestions:E})}if(f(a))throw Error("require {object} settings");var m=a.repository;if(f(m))throw Error("require {repository} settings.repository");
if(!n(m,"Object"))throw Error("require {repository} settings.repository is root node object");var x=a.indexOnFields||[];if(q(x))throw Error("require index field on {string[]} : settings.indexOnFields");if(-1!==p("nodes",x))throw Error("field name 'nodes' in {string[]} : settings.indexOnFields is reserved word");var t=new H(a.highlightClass||"keyword-highlight"),v=a.indexStore||new J(a.maximumDictionaryKeySize||3);C.ensureImplements(v,[I]);var u=new K(v),A=new L(v),B=a.indexSeparator||"/",y=a.postfixFieldNameHighlight||
"Highlight",F,s="",z={},G=a.additionalDictionaries||[],E=[],O=a.suggestionsSize,P=a.percentSuggest,N=a.stopword||function(a){a=f(a)?"":a.replace(/\(/g," ").replace(/\)/g," ").replace(/\,/g," ").replace(/\//g," ").replace(/\\/g," ").replace(/\:/g," ").replace(/\./g," ").replace(/\>/g," ").replace(/\</g," ").replace(/\[/g," ").replace(/\]/g," ").replace(/\+/g," ").replace(/\=/g," ").replace(/\;/g," ");return a.split(" ")};b();this.reIndex=function(a){m=a;b()};this.getKeyword=function(){return s};this.getRepository=
function(){return m};this.getIndexs=function(){return A.getIndexs()};this.clear=function(){s="";return new D({content:m})};this.search=function(a){if(q(a))return new D({content:m});a=a.trim().toLowerCase();if(s===a)return w();t.resetTotal();F={nodes:[]};E=[];s=a;E=(new M({dictionary:A.getDictionaries(s),suggestionsSize:O,percentSuggest:P,highlighter:t})).getSuggestionsWhenSearchFound(s);s=r();var b=A.readIndex(s),c;for(c in b){var d=b[c].split(B),e=m,h=F,l=void 0;for(l in d){var g=d[l];if(q(g))break;
var e=e.nodes[g],k=h.nodes[g];if(f(k)){var k=e,n={},p=void 0;for(p in k)if("nodes"!==p){n[p]=k[p];for(var v in x)if(p===x[v]){var u=t.highlight(s,n[p]);!q(u)&&(n[p+y]=u)}}k=n;h.nodes[g]=k}f(k.nodes)&&(k.nodes=[]);h=k}}s=a;return w()}}}();window.Blogger=window.Blogger||{};
window.Blogger.pullRepositoryFromBlog=function(q,p){var u=document.createElement("script");u.type="text/javascript";u.src=q+"/feeds/posts/default?max-results=10000&alt=json-in-script&callback=blogFeedCallback";u.onload=function(){p(window.blogFeedRepository)};document.getElementsByTagName("head")[0].appendChild(u)};
function blogFeedCallback(q){function p(l){l=l.sort(function(l,f){return l.published>f.published})}function u(l){var f=n.nodes,g;for(g in f){var p=f[g];if(p.name===l)return p}return null}function g(f){f=f.link;for(var g in f)if("alternate"===f[g].rel)return f[g].href;return""}var n={nodes:[]},f=q.feed,t=f.category,v;for(v in t)q=t[v],n.nodes.push({name:q.term,link:"/search/label/"+encodeURIComponent(q.term)});f=f.entry;for(v in f){t=f[v];t.title.$t;var C=t.category,D;for(D in C){q=u(C[D].term);var A=
q.nodes;A||(A=[]);var B={name:t.title.$t,published:new Date(t.published.$t),link:g(t),nodes:[]};5>v&&(B.newPost=!0);A.push(B);q.nodes=A}}(function(f){f=f.sort(function(f,g){return f.name.localeCompare(g.name)})})(n.nodes);for(v in n.nodes)B=n.nodes[v],p(B.nodes);window.blogFeedRepository=n};




<commit_msg>separate highlighter between keyword and suggestion<commit_after>/**
 * IndexSearch.js
 *
 * author     -->  redcrow (jit<NAME>)
 * create on  -->  26/08/2013
 * website    -->  na5cent.blogspot.com
 * 
 * version    -->  1.0
 * version    -->  2.0 (multiple search keyword : AND search operation)
 * 
 * License    ---> Apache License
 * Version 2.0, January 2004 (http://www.apache.org/licenses/LICENSE-2.0)
 * 
 * 
 * 
 * update 13/12/2013 : add integrate period algorithm (document : http://na5cent.blogspot.com/2013/12/integrate-period-algorithm-javascript.html)
 */

window.IndexSearch=window.IndexSearch||function(){function q(a){return f(a)||0===a.length}function m(a,b,c){if(f(a))return-1;p(b,"String")&&(a=a.toLowerCase(),b=b.toLowerCase());return b.indexOf(a,f(c)?0:c)}function u(a){return a=a.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;")}function g(a,b,c){if(!f(a)&&p(b,"Function"))for(var h in a)if(!1===b.call(c,a[h],h))return!1;return!0}function p(a,b){return Object.prototype.toString.call(a)==="[object "+b+"]"}function f(a){return p(a,
"Undefined")}function t(a){var b=0,c;for(c in a)b+=1;return b}function y(a){var b=parseFloat(a),c=parseInt(a);return 0===b-c?c:(new Number(a)).toFixed(2)}var C=function(){function a(a,b){if(!p(a,"String"))throw Error("constructor of Interface class require first argument is 'string', but is '"+typeof a+"'.");if(!p(b,"Array"))throw Error("constructor of Interface class require second argument is 'array of string', but is '"+typeof b+"'.");}function b(a,b){if(!p(a,"String"))throw Error("constructor of Interface class require second argument is 'array of string', but method index "+
b+" is not 'string', is '"+typeof a+"'.");return a}return function(c,h){if(2!==arguments.length)throw Error("constructor of Interface class require 2 arguments : Interface({string} name, {string[]} method names");a(c,h);for(var d=[],r=0;r<h.length;r++){var e=b(h[r],r);d.push(e)}this.getName=function(){return c};this.getMethods=function(){return d}}}();C.ensureImplements=function(a,b){if(2!==arguments.length)throw Error("Interface.ensureImplements require 2 arguments : Interface.ensureImplement({object} obj, {interface[]} interfaces).");
if(!p(a,"Object"))throw Error("first argument of Interface.ensureImplements is not 'object', but is '"+typeof a+"'.");if(!p(b,"Array"))throw Error("second argument of Interface.ensureImplements is not 'array of interface', but is '"+typeof b+"'.");for(var c=0;c<b.length;c++){var h=b[c];if(h.constructor!==C)throw Error("second argument of Interface.ensureImplements index "+c+" is not interface.");var d=h.getMethods(),r;for(r in d){var e=d[r];if(f(a[e]))throw Error("implementation class is not define method '"+
e+"' of Interface '"+h.getName()+"'.");if(!p(a[e],"Function"))throw Error("implementation class define '"+e+"' is not 'method', but is '"+typeof a[e]+"'.");}}};var D=function(a){var b=a.totalPosition||0,c=a.totalSentence||0,h=a.content||{nodes:{}},d=a.suggestions||[];this.getTotalPosition=function(){return b};this.getTotalSentence=function(){return c};this.getContent=function(){return h};this.getSuggestions=function(){return d}},z=function(a,b){var c=a,h=b;this.getStart=function(){return c};this.getEnd=
function(){return h};this.setStart=function(a){c=a};this.setEnd=function(a){h=a};this.equals=function(a){return a.getStart()===c&&a.getEnd()===h?!0:!1};this.toString=function(){return"period {"+c+", "+h+"}"}},A=function(){function a(){var a=[];g(h,function(e){a.push(e)});return a}function b(){d=a().sort(function(a,e){return a.getStart()===e.getStart()?a.getEnd()-e.getEnd():a.getStart()-e.getStart()})}function c(a){for(var e in d)d[e].equals(a)&&delete d[e]}var h={},d;this.addPeriod=function(a){var e;
e=a.getStart()+":"+a.getEnd();f(h[e])&&(h[e]=a);return this};this.addAllPeriods=function(a){q(a)||g(a,function(a){this.addPeriod(a)},this);return this};this.integrate=function(){b();if(1<d.length)for(var a=1;a<d.length;a++){var e=d[a-1],k=d[a];k.getStart()<e.getEnd()&&k.setStart(e.getEnd())}if(1<d.length)for(a=1;a<d.length;a++)for(e=d[a],k=a+1;k<d.length;k++){var v=d[k],n;if(n=!f(e))if(n=!f(v))if(n=v,!(n=n.getStart()>=n.getEnd())){n=v;var w=e;n=n.getStart()>=w.getStart()&&n.getEnd()<=w.getEnd()}n&&
c(v)}if(1<d.length)for(a=1;a<d.length;a++)e=d[a-1],k=d[a],f(k)||f(e)||k.getStart()!==e.getEnd()||(k.setStart(e.getStart()),c(e),a--);return d}},l=function(a){var b=a||"",c=0;this.split=function(){var a=[],d=b.split(" ");g(d,function(b){q(b)||(a.push(b),c+=1)});return a};this.getKeywordSize=function(){return c}},B=function(a){function b(a,b){var e=new A,k=new l(b);g(k.split(),function(b){if(q(b))return!0;for(var n=b.length,k=0,c=0;;){c=m(b,a,c);if(-1===c)break;k=c;c+=n;e.addPeriod(new z(k,c))}});return e.integrate()}
var c=0,h=0;this.getTotalSentence=function(){return c};this.resetTotalSentence=function(){c=0};this.getTotalHighlight=function(){return h};this.resetTotalHighlight=function(){h=0};this.resetTotal=function(){c=h=0};this.highlight=function(d,f){c+=1;var e=u(f),k=b(e,d),v=0;g(k,function(b){var k=b.getStart()+v,c=b.getEnd()+v;b=e.substring(0,k);var k=e.substring(k,c),d='<span class="'+a+'">'+k+"</span>",c=e.substring(c);e=b+d+c;v=v+d.length-k.length;h+=1});return e}},I=new C("IndexStore",["writeIndex",
"readIndex","addDictionary","getDictionaries","getIndexs"]),J=function(a){function b(a,b){var v=c(a);return h(v,b)}function c(a){var b={};g(a,function(a){g(a,function(a){f(b[a])&&(b[a]=0);b[a]+=1})});return b}function h(a,b){var c=[];g(a,function(a,e){a>=b&&c.push(e)});return c}var d=a;if(f(d)||1>d)d=1;var r=[];for(a=1;a<=d;a++)r[a]={};this.writeIndex=function(a,b){f(b)||g(r,function(c){g(c,function(c){g(c,function(c,d){-1!==m(d,b)&&-1===m(a,c)&&c.push(a)})})})};this.readIndex=function(a){var c={};
a=new l(a);g(a.split(),function(a){g(this.getDictionaries(a),function(b,e){-1!==m(a,e)&&(f(c[a])&&(c[a]={}),g(b,function(b){c[a][b]=b}))})},this);return b(c,a.getKeywordSize())};this.addDictionary=function(a){a=a.trim().toLowerCase();q(a)||g(r,function(b,c){if(a.length>=c){var d=a.substring(0,c);f(b[d])&&(b[d]={});f(b[d][a])&&(b[d][a]=[])}})};this.getDictionaries=function(a){if(q(a))return{};a=new l(a);var b={};g(a.split(),function(a){var c=b;a.length<=d?a=r[a.length][a]:(a=a.substring(0,d),a=r[d][a]);
for(var e in a)c[e]=a[e]});f(b)&&(b={});return b};this.getIndexs=function(){return r}},K=function(a){this.writeIndex=function(b,c){a.writeIndex(b,c)};this.addDictionary=function(b){a.addDictionary(b)}},L=function(a){this.readIndex=function(b){return a.readIndex(b)};this.getDictionaries=function(b){return a.getDictionaries(b)};this.getIndexs=function(){return a.getIndexs()}},N=function(a){function b(a){for(var b={},c=0;c<a.length;c++){var d=a.charAt(c);f(b[d])&&(b[d]={duplicate:0,position:0});b[d].duplicate+=
1;b[d].position+=c}return b}function c(a,c){var n=[],r=(new l(a)).split();g(r,function(r){return g(h,function(h,g){var l;a:{l=n;for(var p in l)if(l[p].word===g){l=!0;break a}l=!1}if(!l){p=b(r);var x,B=b(g);l=0;for(x in p){f(B[x])&&(B[x]={duplicate:0,position:0});var m=p[x],s=B[x],m=m.duplicate+m.position,s=s.duplicate+s.position;if(0!==m&&0!==s){var w=(s+m)/2;l=m>=s?l+s/w:l+m/w}}x=(t(p)+t(B))/2;x=l/x*100;if(x>=c&&(l=d.highlight(a,g),q(l)&&(l=g),n.push({keywordMatch:r,word:g,highlight:l,percent:y(x)}),
n.length===e))return!1}})});return n=n.sort(function(a,b){return b.percent-a.percent})}var h=a.dictionary,d=a.highlighter,r=a.percentSuggest||60,e=a.suggestionsSize||10;this.getSuggestionsWhenSearchFound=function(a){return c(a,0)};this.getSuggestionsWhenSearchNotFound=function(a){return c(a,r)}};return function(a){function b(){for(var a in H)z.addDictionary(H[a]);c(n);for(var b in n.nodes)h(0,b,n.nodes[b]);for(var d in F)delete F[d]}function c(a){for(var b in w){var d=a[w[b]];if(!q(d)){var d=O(d),
e=void 0;for(e in d)z.addDictionary(d[e])}}a=a.nodes;if(!q(a))for(var f in a)c(a[f])}function h(a,b,c){d(c,function(a){z.writeIndex(b,a)});c.level="level-"+a;c.index=b+"";c=c.nodes;if(!q(c))for(var e in c)h(a+1,b+x+e,c[e])}function d(a,b){for(var c in w){var d=w[c],e=F[d];f(e)&&(e={},F[d]=e);var h=e[a[d]];f(h)&&(h=!0,e[a[d]]=h,b(a[d]))}}function r(){var a={};g(E,function(b){var c=b.word[0];f(a[c])&&(a[c]=[]);a[c].push(b.word)});var b=(new l(s)).split();g(a,function(a){a=a[0];for(var c in b){var d=
b[c];d[0]===a[0]&&(a.length<d.length||-1===m(d,a))&&(b[c]=a)}});e(b);return k(b)}function e(a){var b=[];g(a,function(a){g(E,function(c){a===c.word||-1!==m(c,b)||b.push(c)})});E=b}function k(a){var b={},c;for(c in a)b[a[c]]=a[c];a=[];for(var d in b)a.push(d);return a.join(" ")}function v(){return new D({totalPosition:t.getTotalHighlight(),totalSentence:t.getTotalSentence(),content:G,suggestions:E})}if(f(a))throw Error("require {object} settings");var n=a.repository;if(f(n))throw Error("require {repository} settings.repository");
if(!p(n,"Object"))throw Error("require {repository} settings.repository is root node object");var w=a.indexOnFields||[];if(q(w))throw Error("require index field on {string[]} : settings.indexOnFields");if(-1!==m("nodes",w))throw Error("field name 'nodes' in {string[]} : settings.indexOnFields is reserved word");var t=new B(a.highlightClass||"keyword-highlight"),y=new B(a.highlightClass||"keyword-highlight"),u=a.indexStore||new J(a.maximumDictionaryKeySize||3);C.ensureImplements(u,[I]);var z=new K(u),
A=new L(u),x=a.indexSeparator||"/",M=a.postfixFieldNameHighlight||"Highlight",G,s="",F={},H=a.additionalDictionaries||[],E=[],P=a.suggestionsSize,Q=a.percentSuggest,O=a.stopword||function(a){a=f(a)?"":a.replace(/\(/g," ").replace(/\)/g," ").replace(/\,/g," ").replace(/\//g," ").replace(/\\/g," ").replace(/\:/g," ").replace(/\./g," ").replace(/\>/g," ").replace(/\</g," ").replace(/\[/g," ").replace(/\]/g," ").replace(/\+/g," ").replace(/\=/g," ").replace(/\;/g," ");return a.split(" ")};b();this.reIndex=
function(a){n=a;b()};this.getKeyword=function(){return s};this.getRepository=function(){return n};this.getIndexs=function(){return A.getIndexs()};this.clear=function(){s="";return new D({content:n})};this.search=function(a){if(q(a))return new D({content:n});a=a.trim().toLowerCase();if(s===a)return v();t.resetTotal();y.resetTotal();G={nodes:[]};E=[];s=a;E=(new N({dictionary:A.getDictionaries(s),suggestionsSize:P,percentSuggest:Q,highlighter:y})).getSuggestionsWhenSearchFound(s);s=r();var b=A.readIndex(s),
c;for(c in b){var d=b[c].split(x),e=n,h=G,l=void 0;for(l in d){var g=d[l];if(q(g))break;var e=e.nodes[g],k=h.nodes[g];if(f(k)){var k=e,p={},m=void 0;for(m in k)if("nodes"!==m){p[m]=k[m];for(var B in w)if(m===w[B]){var u=t.highlight(s,p[m]);!q(u)&&(p[m+M]=u)}}k=p;h.nodes[g]=k}f(k.nodes)&&(k.nodes=[]);h=k}}s=a;return v()}}}();window.Blogger=window.Blogger||{};
window.Blogger.pullRepositoryFromBlog=function(q,m){var u=document.createElement("script");u.type="text/javascript";u.src=q+"/feeds/posts/default?max-results=10000&alt=json-in-script&callback=blogFeedCallback";u.onload=function(){m(window.blogFeedRepository)};document.getElementsByTagName("head")[0].appendChild(u)};
function blogFeedCallback(q){function m(l){l=l.sort(function(l,f){return l.published>f.published})}function u(l){var f=p.nodes,g;for(g in f){var m=f[g];if(m.name===l)return m}return null}function g(f){f=f.link;for(var g in f)if("alternate"===f[g].rel)return f[g].href;return""}var p={nodes:[]},f=q.feed,t=f.category,y;for(y in t)q=t[y],p.nodes.push({name:q.term,link:"/search/label/"+encodeURIComponent(q.term)});f=f.entry;for(y in f){t=f[y];t.title.$t;var C=t.category,D;for(D in C){q=u(C[D].term);var z=
q.nodes;z||(z=[]);var A={name:t.title.$t,published:new Date(t.published.$t),link:g(t),nodes:[]};5>y&&(A.newPost=!0);z.push(A);q.nodes=z}}(function(f){f=f.sort(function(f,g){return f.name.localeCompare(g.name)})})(p.nodes);for(y in p.nodes)A=p.nodes[y],m(A.nodes);window.blogFeedRepository=p};








{'fraction_non_alphanumeric': 0.29242488362251373, 'fraction_numerical': 0.011341515023275498, 'mean_word_length': 10.965063291139241, 'pattern_counts': {'":': 4, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3086799', 'n_tokens_mistral': 10214, 'n_tokens_neox': 10034, 'n_words': 980}