def handle_spell(self, event, word, strategy): connection = Connection(self.server, self.port) word = word.encode('utf-8') strategies = connection.getstratdescs().keys() if connection.match('*', 'exact', word): event.addresponse(choice(( u'That seems correct. Carry on', u'Looks good to me', u"Yup, that's a word all right", u'Yes, you *can* spell', ))) return strategy = strategy is None and 'lev' or strategy.lower() if strategy not in strategies: event.addresponse( u"I'm afraid I don't know about such a strategy. I know about: %s", human_join(sorted(strategies))) suggestions = connection.match('*', strategy, word) if suggestions: event.addresponse(u'Suggestions: %s', human_join( self.reduce_suggestions(suggestions), conjunction=u'or')) else: event.addresponse(u"That doesn't seem correct, but I can't find anything to suggest")
def handle_spell(self, event, word, strategy): connection = Connection(self.server, self.port) word = word.encode('utf-8') strategies = connection.getstratdescs().keys() if connection.match('*', 'exact', word): event.addresponse(choice(( u'That seems correct. Carry on', u'Looks good to me', u"Yup, that's a word all right", u'Yes, you *can* spell', ))) return strategy = strategy is None and 'lev' or strategy.lower() if strategy not in strategies: event.addresponse( u"I'm afraid I don't know about such a strategy. I know about: %s", human_join(sorted(strategies))) suggestions = connection.match('*', strategy, word) if suggestions: event.addresponse(u'Suggestions: %s', human_join( self.reduce_suggestions(suggestions), conjunction=u'or')) else: event.addresponse(u"That doesn't seem correct, but I can't find anything to suggest")
def handle_strategy(self, event, strategy): connection = Connection(self.server, self.port) strategies = connection.getstratdescs() strategy = strategy.lower() if strategy in strategies: event.addresponse(unicode(strategies[strategy])) else: event.addresponse(u"I don't have that strategy")
def handle_strategy(self, event, strategy): connection = Connection(self.server, self.port) strategies = connection.getstratdescs() strategy = strategy.lower() if strategy in strategies: event.addresponse(unicode(strategies[strategy])) else: event.addresponse(u"I don't have that strategy")
def handle_strategies(self, event): connection = Connection(self.server, self.port) strategies = connection.getstratdescs() event.addresponse(u'My Strategies: %s', human_join(sorted(strategies.keys())))
def handle_strategies(self, event): connection = Connection(self.server, self.port) strategies = connection.getstratdescs() event.addresponse(u'My Strategies: %s', human_join(sorted(strategies.keys())))