ericmiraglia.com

termextractor 

Yahoo! UI Library > termextractor > YAHOO.api.TermExtractor
Search:
 
Filters

Class YAHOO.api.TermExtractor

A utility to retrieve related terms via the Yahoo Term Extractor API.

Constructor

YAHOO.api.TermExtractor ( object )
Parameters:
object <o> An object containing the configuration attributes for term extraction. Members of this configuration object include:
  • el | str ID contextEl: The element from whose value or innerText property terms will be extracted.
  • str proxy: Path to the server-side post proxy that will relay the request and post arguments to the webservice
  • str appid: The Yahoo Developer App ID to use in making the request. (Optional: if this is not provided, the appid must be supplied in your server- side proxy as an additional post variable.

Properties

appid - string

The appid issued by the Yahoo Developer Network for your use. You may choose to omit this property in your JavaScript so as to avoid exposing your appid to prying eyes; in that case, append the appid as a post variable in your server-side proxy.

contextEl - HTMLElement | string ID

The element from whose content terms will be extracted. If an input or textarea, content will be extracted from the element's value; if other, the element's innerText/textContent will be used.

proxy - string

The path to the server-side proxy that will proxy the post request to the API. Path should be relative to the current HTML page and must obey the strict same origin policy enforced by XMLHttpRequest.

Methods

extract

extract ( )
Kicks off a term extraction request. Invoke this method when your context element is populated with the content from which you want to extract key terms -- for example, on the blur event of a text area. There is no return value for this method, as the process is asynchronous; subscribe to your TermExtractor instance's onComplete event to process the results of your extraction request.

Events

onComplete

onComplete ( )
Fired when a term extraction request is complete, whether successful or not. This event uses a FLAT Custom Event signature, meaning that the subscriber gets a single argument -- an object -- which contains all relevant information, including the following members:
  • array terms: An array with all terms returned by the API.
  • string message: Any message coming back from TermExtractor indicating the disposition of the request -- if it failed, the message may give you some indication as to what went wrong.


Copyright © 2008 ericmiraglia.com