Permalink
Browse files

Async support

  • Loading branch information...
vaskonov committed Oct 15, 2015
1 parent 31e51ee commit b84859771262d3728aef1ecfbdaa6bb2b3ff7e84
Showing with 20 additions and 0 deletions.
  1. +20 −0 features/HypernymExtractor.js
@@ -27,3 +27,23 @@ module.exports = function(hypernyms) {
});
}
}
/*
module.exports = function(hypernyms) {
return function(sample, features) {
hypernyms.forEach(function(hypernym) {
var matches = null;
if (hypernym.regexp instanceof RegExp) {
if (!hypernym.regexp.global) {
console.warn("hypernym regexp, "+hypernym.regexp+", is not global - skipping");
return;
}
} else {
hypernym.regexp = new RegExp(hypernym.regexp,"gi");
}
while ((matches = hypernym.regexp.exec(sample)) !== null) {
var feature = matches[0].replace(hypernym.regexp, hypernym.feature);
features[feature]=hypernym.confidence;
}
});
}
}*/

0 comments on commit b848597

Please sign in to comment.