def g(phenny, input):
 query = input.group(2)
 if (not query):
  return phenny.reply('.g what?')
 query = query.encode('utf-8')
 uri = google_search(query)
 if uri:
  phenny.reply(uri)
  if (not hasattr(phenny.bot, 'last_seen_uri')):
   phenny.bot.last_seen_uri = {}
  phenny.bot.last_seen_uri[input.sender] = uri
 elif (uri is False):
  phenny.reply('Problem getting data from Google.')
 else:
  phenny.reply(("No results found for '%s'." % query))

def g ( phenny , input ) : query = input . group ( 2 ) if ( not query ) : return phenny . reply ( '.g what?' ) query = query . encode ( 'utf-8' ) uri = google_search ( query ) if uri : phenny . reply ( uri ) if ( not hasattr ( phenny . bot , 'last_seen_uri' ) ) : phenny . bot . last_seen_uri = { } phenny . bot . last_seen_uri [ input . sender ] = uri elif ( uri is False ) : phenny . reply ( 'Problem getting data from Google.' ) else : phenny . reply ( ( "No results found for '%s'." % query ) )
the function to predict (classification will then consist in predicting whether g(x) <= 0 or not) .