Skip to content

Commit 77b875c

Browse files
committed
Debug dict path
1 parent 2fd54cf commit 77b875c

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"qs": "6.x",
1212
"image-type": "^2.0.2",
1313
"watson-developer-cloud": "^3.15.0",
14-
"kuromoji": "^0.1.1",
14+
"kuromoji": "^0.1.2",
1515
"word-count": "^0.2.2",
1616
"is-docx": "^0.0.3",
1717
"stream-to-array": "^2.3.0",

utilities/payload-utils.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,18 @@ PayloadUtils.prototype = {
157157
// Function that is returns a function to count
158158
// the characters in each language.
159159
word_count: function(ct) {
160-
var count = require('word-count');
161-
var kuromoji = require('kuromoji'),
160+
console.log('performing count for language ', ct);
161+
const count = require('word-count'),
162+
kuromoji = require('kuromoji');
162163
fn = function(txt, cb) {
163164
// default
165+
console.log('performing real count');
164166
return cb(txt.split(' ').length);
165167
},
166168
dic_path = '/../../kuromoji/dict',
167169
dic_dir = path.normalize(__dirname + dic_path),
168170
tokenizer = null;
169-
171+
/*
170172
if (ct === 'ja') {
171173
fn = function(txt, cb) {
172174
kuromoji.builder({dicPath: dic_dir}).build(function(err, tknz) {
@@ -177,8 +179,11 @@ PayloadUtils.prototype = {
177179
return cb(tokenizer.tokenize(txt).length);
178180
});
179181
};
180-
} else if (ct === 'ko') {
182+
} else
183+
*/
184+
if (ct === 'ko' || ct === 'ja') {
181185
fn = function(txt, cb) {
186+
console.log('performing korean count')
182187
cb(count(txt));
183188
};
184189
}

0 commit comments

Comments
 (0)