@botonic/plugin-contentful
Version:
Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet
33 lines • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
//TODO convert to a unit test
// test('TEST: SimilarWordFinder performance', () => {
const nlp_1 = require("../nlp");
const similar_words_1 = require("../nlp/similar-words");
class TestCandidate {
}
function candidate(kws, hasOnlyStopWords = false) {
return new nlp_1.CandidateWithKeywords(new TestCandidate(), kws.map(k => kw(k, hasOnlyStopWords)));
}
function kw(kw, hasOnlyStopWords = false) {
return new nlp_1.Keyword(`${kw}`, kw.split(' ').map(w => new nlp_1.Word(w, w)), hasOnlyStopWords);
}
function ut(text) {
return new nlp_1.NormalizedUtterance(text, text.split(' ').map(w => new nlp_1.Word(w, w)));
}
function perform() {
const sut = new similar_words_1.SimilarWordFinder(true);
for (let i = 0; i < 50; i++) {
sut.addCandidate(candidate([`kw${i}`]));
}
let utterance = '';
for (let i = 0; i < 130; i++) {
utterance += String(i) + ' ';
}
console.log(utterance.length);
console.log(new Date());
sut.find(nlp_1.MatchType.KEYWORDS_AND_OTHERS_FOUND, ut(utterance), 1);
console.log(new Date());
}
perform();
//# sourceMappingURL=search-performance.js.map