Permalink
Browse files

Pretty sure it is useless, but caching array size

  • Loading branch information...
1 parent d572fed commit 3b6c70891ba9c8f41dd5115a02c1a15149616777 @gmarty gmarty committed Oct 12, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/natural/tokenizers/tokenizer_ja.js
@@ -183,7 +183,9 @@ TokenizerJa.prototype.tokenize = function(text) {
var seg = ['B3', 'B2', 'B1'];
var ctype = ['O', 'O', 'O'];
var o = text.split('');
- for (i = 0; i < o.length; ++i) {
+ var i;
+ var length;
+ for (i = 0, length = o.length; i < length; ++i) {
seg.push(o[i]);
ctype.push(this.ctype_(o[i]));
}
@@ -197,7 +199,7 @@ TokenizerJa.prototype.tokenize = function(text) {
var p1 = 'U';
var p2 = 'U';
var p3 = 'U';
- for (var i = 4; i < seg.length - 3; ++i) {
+ for (i = 4, length = seg.length - 3; i < length; ++i) {
var score = this.BIAS__;
var w1 = seg[i - 3];
var w2 = seg[i - 2];

0 comments on commit 3b6c708

Please sign in to comment.