diff --git a/data/models/urlStopwords.js b/data/models/urlStopwords.json similarity index 95% rename from data/models/urlStopwords.js rename to data/models/urlStopwords.json index 75ce37e..bacd7fa 100644 --- a/data/models/urlStopwords.js +++ b/data/models/urlStopwords.json @@ -1,4 +1,4 @@ -var interestsUrlStopwords = { +{ "com": true, "net": true, "org": true, diff --git a/lib/WorkerFactory.js b/lib/WorkerFactory.js index 50d7734..a2d84bc 100644 --- a/lib/WorkerFactory.js +++ b/lib/WorkerFactory.js @@ -85,7 +85,7 @@ WorkerFactory.prototype = { let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader); scriptLoader.loadSubScript(data.url("models/" + this._localeCode + "/" + modelName + "/domainRules.js")); // use the same url stop words - scriptLoader.loadSubScript(data.url("models/urlStopwords.js")); + let interestsUrlStopwords = JSON.parse(data.load("models/urlStopwords.json")); let worker = new ChromeWorker(data.url("interests/interestsWorker.js")); worker.postMessage({ diff --git a/test/test-ChineseTokenizer.js b/test/test-ChineseTokenizer.js index e2c4181..3593b43 100644 --- a/test/test-ChineseTokenizer.js +++ b/test/test-ChineseTokenizer.js @@ -13,7 +13,7 @@ const {testUtils} = require("./helpers"); const {Cc, Ci} = require("chrome"); let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader); -scriptLoader.loadSubScript(data.url("models/urlStopwords.js")); +let interestsUrlStopwords = JSON.parse(data.load("models/urlStopwords.json")); scriptLoader.loadSubScript(data.url("models/zh-CN/41-cat/domainRules.js")); scriptLoader.loadSubScript(data.url("interests/tokenizers/zh-CN.js"));