def testSpellingLong(self): """--spelling should check spelling""" google.main(["--spelling", self.phrase]) commandLineAnswer = self.lastOutput() google._output(google.doSpellingSuggestion(self.phrase), self.spellingparams) self.assertEqual(commandLineAnswer, self.lastOutput())
def handleCommand(self, bot, nick, channel, argument=None): if argument is None: return try: data = google.doSpellingSuggestion(argument) except: bot.msg(channel, 'Exception in google.doSpellingSuggestion()') return if data is not None: bot.msg(channel, data) else: bot.msg(channel, 'Leider nix am Start.')
def google_spelling(query, destination): try: data = google.doSpellingSuggestion(query) if data != '': if option["resultsintab"] == True: destination.prnt(data) else: destination.command("say " + data) except Exception, args: print color["red"], Exception, args return
def google_spell(word): import google if ord(word[0]) > 128: return ## 한글이면 if word.find(' ') != -1: return if word.find('-') != -1: return key = 'Nx3n4NtQFHJLZCH32gaWjrZsEPiXvRr7' suggested = google.doSpellingSuggestion(word, key) if suggested !=None: print """<br/><font color="red"> <b>대신, 이 단어로 검색해보세요 </b> </font> <font color="green"> <a href="/ad.py?F=3&W=%s"><b>%s</b></a> </font> <br/><br/>""" % (suggested, suggested) save_spell(word, suggested)
def chanmsg_handler(channel, nick, cmd, args): g = sys.modules['gg'] action = "" q = " " for i in args: q += i+" " spell = google.doSpellingSuggestion(q) if spell != None: action = 'PRIVMSG %s :Perhaps you mean %s?\r\n' % (channel, spell) data = google.doGoogleSearch(spell) action += 'PRIVMSG %s :Then it would be %s .. else:\r\n' % (channel, data.results[0].URL) data = google.doGoogleSearch(q) action += 'PRIVMSG %s :%s\r\n' % (channel, data.results[0].URL) return action
def handler_google_spell(type, source, parameters): correction = google.doSpellingSuggestion(parameters) if not correction: correction = "No Suggestion" smsg(type, source, correction)
def getSpellingsuggestion(qterm): r = google.doSpellingSuggestion(qterm) return r
def doSpellingSuggestion(self, phrase, http_proxy=None): #doSpellingSuggestion google.setLicense(self.license_key) return google.doSpellingSuggestion(phrase, self.license_key, http_proxy)
import google key = 'Nx3n4NtQFHJLZCH32gaWjrZsEPiXvRr7' word = 'dellight' suggested = google.doSpellingSuggestion(word, key) print suggested
def doSpellingSuggestion(self, phrase, http_proxy = None): google.setLicense( self.license ) return google.doSpellingSuggestion(phrase, self.license, http_proxy)
import google key = "Nx3n4NtQFHJLZCH32gaWjrZsEPiXvRr7" word = "dellight" suggested = google.doSpellingSuggestion(word, key) print suggested
def handler_google_spell(type, source, parameters): correction = google.doSpellingSuggestion(parameters) if not correction: correction = 'No Suggestion' smsg(type, source, correction)
# GOOGLE Spelling Suggestion (Did you mean?) Example import google # You can retrieve you license key here: https://code.google.com/ google.LICENSE_KEY = '...' phrase = 'I said something wring' did_you_mean = google.doSpellingSuggestion(phrase, license_key=None, http_proxy=None) # Did you mean.. # I said something *wrong* print(did_you_mean)