Ejemplo n.º 1
0
exports.generateSearchQuery = function (statement) {
	if (statement) {
		var r = '';
		var s = nlp.pos(statement).sentences[0];
		var a = [];

		a = a.concat(s.entities());
		a = a.concat(s.people());
		a = a.concat(s.nouns());
		a = a.concat(s.adjectives());
		a = a.concat(s.adverbs());
		a = a.concat(s.values());
		a = a.concat(nlp.value(statement).date());

		a.forEach(function (element) {
			if (element && element.normalised && r.indexOf(element.normalised) == -1) {
				r = element.normalised + ' ' + r;
			}
		}, this);

		return that.generateEasterEgg(r);
	} else {
		return statement;
	}

};
Ejemplo n.º 2
0
function grabTopics(text) {
    var nlpProcessed = nlp.text(text);
    // console.log('nlpProcessed', nlpProcessed);
    return Promise.resolve({
        action: null,
        details: {
            dates: nlpProcessed.dates(),
            people: nlpProcessed.people(),
            value: nlp.value(text).number,
        },
        topic: 'details',
    });
}