Exemple #1
0
    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")
Exemple #2
0
    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")
Exemple #3
0
 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")
Exemple #4
0
 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")
Exemple #5
0
 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())))
Exemple #6
0
 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())))