Fix and a test to title classification
This commit is contained in:
Родитель
4f62341faa
Коммит
1ec86241a2
|
@ -74,7 +74,7 @@ UrlClassifier.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
classifyPage: function I__ClassifyPage(url,title) {
|
||||
classifyPage: function I__ClassifyPage(url, title) {
|
||||
if (this._deferred) {
|
||||
return this._deferred.promise;
|
||||
}
|
||||
|
@ -83,13 +83,12 @@ UrlClassifier.prototype = {
|
|||
this._results = {};
|
||||
try {
|
||||
// submit url+title to workers
|
||||
let title = title || "";
|
||||
let uri = NetUtil.newURI(url);
|
||||
let host = getPlacesHostForURI(uri);
|
||||
let message = {};
|
||||
message.message = "getInterestsForDocument";
|
||||
message.url = url;
|
||||
message.title = title;
|
||||
message.title = title || "";
|
||||
message.host = host;
|
||||
message.path = uri["path"];
|
||||
message.tld = getBaseDomain(host);
|
||||
|
|
|
@ -41,6 +41,14 @@ exports["test url classifier"] = function test_UrlClassifier(assert, done) {
|
|||
assert.ok(true);
|
||||
});
|
||||
|
||||
// classify only the text
|
||||
results = yield urlClassifier.classifyPage("http://www.xyz.com", "iphone, ipad, apple, product, phone");
|
||||
testUtils.isIdentical(assert, results["edrules"].results,
|
||||
[{"type":"rules","interests":[]},
|
||||
{"type":"keywords","interests":["Apple"]},
|
||||
{"type":"combined","interests":["Apple"]}
|
||||
]);
|
||||
|
||||
}).then(done);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче