Re:A Quick Puzzle to Test Your Problem Solving
by 109876 on Thursday July 02, 2015 @01:40PM
(#9820382)
Full method just for fun:
function judgeSentence(sentence, numNo) {
sentence = sentence.toLowerCase();
// no nos -> wrong.
if (numNo === 0 || sentence == "") {
return false;
}
// if have any fancy words -> wrong.
var probablyWrong = ["doubl", "expon", "multipl", "^", "**", "power", "two", "2", "twice", "as big", "nth", "rais"];
if (hasAny(probablyWrong, sentence)) {
return false;
}
// if you have the right words, and no buts.
var seemsRight = ["larger", "increas", "greater", "small", "less", "big", ">", "<", "go up", "ascending"],
weaselWords = ['but ', 'not ', 'odd'];
if (hasAny(seemsRight, sentence) & !hasAny(weaselWords, sentence)) {
return true;
}
// // no nouns, verbs or adjectives in your sentence -> wrong.
// var s = nlp.pos(sentence).sentences[0],
// verbs = s.verbs().map(getWords),
// nouns = s.nouns().map(getWords),
// adj = s.adjectives().map(getWords),
// numWords = verbs.length + nouns.length + adj.length;
// if (numWords === 0) {
// return false;
// }
return false;
}
Re:A Quick Puzzle to Test Your Problem Solving
by TeMPOraL on Thursday July 02, 2015 @10:30AM
(#9819103)
It's surprising how far you can go by such heuristics. I run an IRC bot that uses matches like this (I'm working on a proper solution right now though) to parse natural language queries and I managed to trick few people into thinking they're talking with human. As long as it's ok for 90% of most common cases, people often won't notice.
Re:A Quick Puzzle to Test Your Problem Solving
by tomerico on Thursday July 02, 2015 @02:26PM
(#9820667)
Which is another case of confirmation bias
Re:A Quick Puzzle to Test Your Problem Solving
by tripzilch on Friday July 03, 2015 @10:16AM
(#9825693)
I've made a robot that screams[0]. That is, just outputs a random string of "AAAAaaa" when its name is mentioned or when somebody else screams (four or more A's).
What is surprising is how basically 15 lines of python implementing these rules, invokes a very real emotional response in a lot of people :-)
I named it "Wilhelm".
[0] inspired by this comic http://gunshowcomic.com/513
Re:A Quick Puzzle to Test Your Problem Solving
by stillsut on Thursday July 02, 2015 @01:03PM
(#9820150)
include "monoton" in probablyWrong.
The sequence is not monotonically increasing.
Re:A Quick Puzzle to Test Your Problem Solving
by thekingofspain on Thursday July 02, 2015 @02:12PM
(#9820591)
Interestingly, it would appear that monotonically increasing in general means "strictly increasing": http://mathworld.wolfram.com/MonotoneIncreasing.htm
It only means non-decreasing in the context of a monotonic function, where the definition, I believe, is that the derivative of the function is never <0.
var probablyWrong = ["doubl", "expon", "multipl", "^", "", "power", "two", "2", "twice", "as big", "nth", "rais"];
var seemsRight = ["larger", "increas", "greater", "small", "less", "big", ">", "<", "go up", "ascending"], weaselWords = ['but ', 'not ', 'odd'];
Been expecting something more interesting than that