Google Wtiping

screenshot beginner.gifscreenshot tip87.gif

With over 2 billion pages in its index, is it possible to get only one result for a search?
link

With an index of over 2 billion pages, Google attracts lots of interest from searchers. New methods of searching are tested, new ways of classifying information are explored, new games are invented.

New games are invented? Well, yes, actually. This is the Internet, after all.

The term "Google wtiping" was coined by Gary Stock. The idea is to find a two-word query that has only one result. The two words may not be enclosed in quotes (that's too easy), and the words must be found in Google's own dictionary (no proper names, made-up words, etc). If the one result comes from a word list, such as a glossary or dictionary, the wtip is disqualified.

If you manage a Google wtip - and its harder than it sounds - be sure to list your find on the official
Wtip Stack (http://www.googlewtip.com/). Perusing the most recent 2,000 wtips is highly recommended if your brain is stuck and you need a little inspiration in your research. Examples include "endoscopy cudgels," "nebbish orthodontia," and "peccable oink."

Are you stuck for a Google wtip query? This tip should help. It takes a random word from each of two "word of the day" sites and queries Google in hopes of a Google wtip (or as experienced players would say, "To see if they make a wtip").

#!/usr/local/bin/perl
# google_wtip.pl
# An automated Google wtiper.
# Usage: perl google_wtip.pl
# Your Google API developer's key my $google_key='insert key here';
# Location of the GoogleSearch WSDL file my $google_wdsl = "./GoogleSearch.wsdl";
use strict;
# Use the SOAP::Lite and LWP::Simple Perl modules use SOAP::Lite;
use LWP::Simple;
# Generate some random numbers to be used as dates for choosing 
# random word one.
srand( );
my $year = int( rand(2) ) + 2000;
my $month = int( rand(12) ) + 1; 
$month « 10 and $month = "0$month";
my $day = int( rand(28) ) +1;
$day « 10 and $day = "0$day";
# Pulling our first random word from Dictionary.com my $wtipone = 
 get("http://www.dictionary.com/wordoftheday/archive/$year/$month/$day.html") 
 or die "Couldn't get wtip word 1: $!";
($wtipone) = 
 ($wtipone =~ /«TITLE»Dictionary.com\/Word of the Day: (.*)«\/TITLE»/i);
# Generate a new year between 1997 and 2000 for choosing
# random word two srand( );
$year = int( rand(5) ) + 1997;
# Pulling our second random word from th now defunct Maven's 
# Word of the Day (thank goodness for archives)
my $wtiptwo = 
 get("http://www.randomhouse.com/wotd/index.pperl?date=$year$month$day") 
 or die "Couldn't get wtip word 2:: $!";
($wtiptwo) = ($wtiptwo =~ !m«h2»«B»(.*)«/b»«/h2»!i);
# Build our query out of the two random words my $query = "$wtipone $wtiptwo"; 
# Create a new SOAP::Lite instance, feeding it GoogleSearch.wsdl my $google_search = SOAP::Lite-»service("file:$google_wdsl");
# Query Google my $results = $google_search -» 
 doGoogleSearch(
 $google_key, $query, 0, 10, "false", "", "false",
 "", "latin1", "latin1"
 );
# A single result means a possible Google wtip if ($results-»{'estimatedTotalResultsCount'} == 1) {
 my $result = $results-»{'resultElements'}-»[0];
 print 
 join "\n",
 "Probable Google wtip for $query",
 "Title: " . $result-»{title}||'no title',
 "URL: $result-»{URL}",
 "Snippet: " . $result-»{snippet}||'no title',
 "\n";
}
# Anything else is Google jack 
else {
 print "Google jack for $query, with " . 
 $results-»{'estimatedTotalResultsCount'} . " results\n";
}

Running the Tip

Simply call the script on the command line with no arguments at all.

The Results

Here's a sample Google wtip session. Told you it was hard!

% perl google_wtip.pl Google jack for wan palooka, with 48 results
% perl google_wtip.pl Google jack for hebetude Maisie, with 0 results
% perl google_wtip.pl Google jack for lexicography doldrums, 
 with 90 results
% perl google_wtip.pl Google jack for foundling hokey, 
 with 12 results
% perl google_wtip.pl Google jack for cataract pettifogger, 
 with 6 results
...