RiTa
index
Name RiGoogleSearch
Description A utility object for obtaining unigram, bigram, and weighted-bigram counts for words and phrases via the Google search engine.
      RiGoogleSearch gp = new RiGoogleSearch(this);
      float f = gp.getBigram("canid", "ski'd");
Constructors
RiGoogleSearch(pApplet);
Methods
getBigram()   Returns the bigram coherence for the word pair where coherence(w1, w2) = count(w1 + w2)/(count(w1) + count(w2)) [from Gervas]

getBigramAvg()   Returns the avg value of all bigram pairs in the sentence.

getBigramMin()   Returns the min value of all bigram pairs in the sentence.

getCallCount()   Returns the number of live URL connections made by this object so far

getCookie()   Returns the cookie string used in the last sent query

getCount()   Returns the number of hits via Google for the search query. To obtain an exact match, place your query in quotes, e.g.
   int k = gp.getCount("\"attained their momentum\"");
 


getUserAgent()   Returns the current user-agent

getWeightedBigram()   Returns the product of the avg value of all bigram pairs and the min bigram value in the sentence. Equivalent to ( but more efficient than): getBigramAvg(s) * getBigramMin(s)

getWeightedUnigram()   Returns the product of the count of the query and the # of words.

setCookie()   Sets the cookie string for subsequent requests

setLocalCookiePath()   Allows the google cookie to be automatically loaded from the file system. As an example, the path for Safari is generally: '/Users/$userName/Library/Cookies/Cookies.plist'

setUserAgent()   Sets the user-agent for subsequent requests

useGoogleBooks()   if set to true, searches are restricted to google books

RiGoogleSearch.isCacheEnabled()   Returns whether the cache is enabled

RiGoogleSearch.setCacheEnabled()   Sets whether the cache is enabled and duplicate requests are returned immediately rather than re-contacting google (default=true).

Usage Web & Application