YQLAutoTagger – automatic tag generation with a single line of JavaScript

Yesterday I gave a talk at the Stackoverflow Devdays conference in London and as one example of the powers of YQL, I wrote a GreaseMonkey script that enhances the Stackoverflow question form to automatically add tags to the question. You can see a screencast of the script or install it yourself from GitHub. The script uses the Yahoo Term Extractor API and some lines of JS to make that work.

I’ve now cleaned up the script a bit and made it work outside of Greasemonkey as a simple JavaScript to embed into any document. See it in action on YouTube:

The demo page shows you how to do that in your own documents, all you need to do is embed the script and give it the IDs of the form fields:

<form action="#" method="get" accept-charset="utf-8">
  <div>
     <label for="mainfield">Your Message:</label>
     <textarea id="mainfield" name="mainfield">Hello I am a programmer that does care about interfaces. What kind of library can I use that gives me a defined set of widgets that have been tested in the real world?</textarea>
 </div>
   <div>
      <label for="tags">Tags:</label><input type="text" id="tags" name="tags">
   </div>
</form>

<script type="text/javascript" src="http://github.com/codepo8/YQLAutoTagger/raw/master/YQLAutoTagger.js">
</script>
<script type="text/javascript">YQLAutoTagger.init('mainfield','tags');</script>

There are some ways to customise the script and its behaviour, all of which are described on GitHub. Download the script from GitHub and read the docs there.

Tags: , , ,

2 Responses to “YQLAutoTagger – automatic tag generation with a single line of JavaScript”

  1. Eric Says:

    The demo always gives me the same tags, whatever I put in the message (event something totally irrelevant to these tags).

  2. Chris Says:

    Duh, good catch! Fixed that now.

Leave a Reply

Wait till I come! is the blog of Christian Heilmann , a developer evangelist living and working in London, England. Download vcard.

Feed me, Seymour: Entries (RSS) and Comments (RSS).