6 ms·
function judgeSentence(sentence, numNo) var probablyWrong = ["doubl", "expon", "multipl", "^", "", "power", "two", "2", "twice", "as big", "nth", "rais"]; var
by cabirum 11y ago
function judgeSentence(sentence, numNo)
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
- TeMPOraL 11y agoIt'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.
- tomerico 11y agoWhich is another case of confirmation bias
- tripzilch 11y agoI'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 http://gunshowcomic.com/513
- stillsut 11y agoinclude "monoton" in probablyWrong. The sequence is not monotonically increasing.
- thekingofspain 11y agoInterestingly, it would appear that monotonically increasing in general means "strictly increasing": http://mathworld.wolfram.com/MonotoneIncreasing.htm 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.
- 109876 11y agoFull 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; }