def noun_test_console(): """ Entry point for noun test console. """ noun_util.init_nouns() while True: message = raw_input("> ") for noun in noun_util.get_contained_nouns(message): print "{} {}".format(noun_util.get_article(noun), noun)
def do_command(self, c, target, nick, message, at_me): do = any([ at_me, do_chance(), nick.startswith('earlbot'), ]) if do: nouns = noun_util.get_contained_nouns(message) if len(nouns) > 0: # Normall want the last noun nouns = sorted(nouns, key=lambda x: len(x)) noun = nouns[-1] else: noun = noun_util.get_noun() article = noun_util.get_article(noun) msg = "{}: You're {} {}".format(nick, article, noun) c.privmsg(target, msg)