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())
示例#2
0
 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.')
示例#3
0
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        
示例#4
0
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)
示例#5
0
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
示例#6
0
def handler_google_spell(type, source, parameters):
    correction = google.doSpellingSuggestion(parameters)
    if not correction:
        correction = "No Suggestion"
    smsg(type, source, correction)
示例#7
0
def getSpellingsuggestion(qterm):
    r = google.doSpellingSuggestion(qterm)
    return r
示例#8
0
 def doSpellingSuggestion(self, phrase, http_proxy=None):
     #doSpellingSuggestion
     google.setLicense(self.license_key)
     return google.doSpellingSuggestion(phrase, self.license_key,
                                        http_proxy)
示例#9
0
import google

key = 'Nx3n4NtQFHJLZCH32gaWjrZsEPiXvRr7'
word = 'dellight'
suggested = google.doSpellingSuggestion(word, key)
print suggested
示例#10
0
 def doSpellingSuggestion(self, phrase, http_proxy = None):
     google.setLicense( self.license )
     return google.doSpellingSuggestion(phrase, self.license, http_proxy)
示例#11
0
import google

key = "Nx3n4NtQFHJLZCH32gaWjrZsEPiXvRr7"
word = "dellight"
suggested = google.doSpellingSuggestion(word, key)
print suggested
示例#12
0
def getSpellingsuggestion(qterm):
    r = google.doSpellingSuggestion(qterm)
    return r
示例#13
0
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)
示例#15
0
 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())