<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Surf Canyon &#187; Code</title>
	<atom:link href="http://blog.surfcanyon.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.surfcanyon.com</link>
	<description>Unleash the Power of Search</description>
	<lastBuildDate>Wed, 25 Jan 2012 21:45:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Panel Participation at Add-on-Con</title>
		<link>http://blog.surfcanyon.com/2010/01/25/panel-participation-at-add-on-con/</link>
		<comments>http://blog.surfcanyon.com/2010/01/25/panel-participation-at-add-on-con/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 18:57:07 +0000</pubDate>
		<dc:creator>Surf Canyon</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.surfcanyon.com/2010/01/25/panel-participation-at-add-on-con/</guid>
		<description><![CDATA[Once again, Mike Wertheim, our Chief Architect, participated in a panel discussion at the 2009 Add-on-Con on December 11th at the Computer History Museum in Mountain View. Like last year&#8217;s topic, this one was related to cross-browser development. For everyone who missed it, you can watch the video either below or on the Add-on-Con blog. [...]]]></description>
			<content:encoded><![CDATA[<p>Once again, <a href="http://www.surfcanyon.com/team.jsp" target="_blank">Mike Wertheim</a>, our Chief Architect, participated in a panel discussion at the 2009 <a href="http://addoncon.com" target="_blank">Add-on-Con</a> on December 11th at the Computer History Museum in Mountain View. Like <a href="http://blog.surfcanyon.com/2008/12/06/panel-participatation-at-add-on-con/" target="_blank">last year&#8217;s topic</a>, this one was related to cross-browser development. For everyone who missed it, you can watch the video either below or on the Add-on-Con <a href="http://addoncon.com/blog/?p=116" target="_blank">blog</a>.</p>
<p><object height="300" width="400"></object><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8675609&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=fc0532&amp;fullscreen=1"></param><embed src="http://vimeo.com/moogaloop.swf?clip_id=8675609&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=fc0532&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="300" width="400"></embed><a href="http://vimeo.com/8675609">Add-on-Con &#8217;09 Cross Browser Development</a> from <a href="http://vimeo.com/addoncon">Robert</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/blog.surfcanyon.com/p=259</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fast &amp; Easy Wordnet Java</title>
		<link>http://blog.surfcanyon.com/2008/07/21/fast-easy-wordnet-java/</link>
		<comments>http://blog.surfcanyon.com/2008/07/21/fast-easy-wordnet-java/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 22:18:18 +0000</pubDate>
		<dc:creator>Surf Canyon</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://blog.surfcanyon.com/2008/07/21/fast-easy-wordnet-java/</guid>
		<description><![CDATA[One of the techniques that Surf Canyon uses to determine if a search result is relevant to your query is to examine synonyms. Princeton University provides Wordnet, a structured lexicon that acts as a dictionary and thesaurus. There are a few open source Java libraries that provide a Java API to Wordnet. We tried using [...]]]></description>
			<content:encoded><![CDATA[<p>One of the techniques that Surf Canyon uses to determine if a search result is relevant to your query is to examine synonyms.  Princeton University provides Wordnet, a structured lexicon that acts as a dictionary and thesaurus.  There are a few open source Java libraries that provide a Java API to Wordnet.  We tried using both JAWS and JWNL, but neither of them provided the response time that the Surf Canyon algorithm requires.  JWNL supposedly provides an in-memory map version of the lexicon, but it seems that no one, including us, has been able to get it to work.</p>
<p>These open source libraries implement much more functionality than what we required. All we want to do is pass in a word and get back a Set of Sets of synonyms for that word. For example, if you pass in the word “fair,” the returned Sets should include the Set of synonyms that mean “evenhanded,” another Set of synonyms that mean “carnival,” and another set of synonyms that mean “attractive.”</p>
<p>Following is a 100-line Java class that implements this functionality very quickly.  First, make sure your CLASSPATH includes the directory that contains the Wordnet database files. The class reads in 4 of the Wordnet database files. (The file names it uses are the file names from the UNIX distribution.  The Windows distribution uses different file names. For example, the UNIX data.verb file is called verb.dat on Windows.)</p>
<p><span id="more-105"></span></p>
<pre>
package com.surfcanyon.common;

import java.io.*;
import java.util.*;

/**
 * This class gets synonym sets from the Wordnet dictionary files.
 */
public abstract class Synonyms {
    private static final Map&lt;String, Set&lt;Set&lt;String&gt;&gt;&gt; WORD_TO_SYNOYMYM_SETS = new HashMap&lt;String, Set&lt;Set&lt;String&gt;&gt;&gt;(15000);
    private static final Set&lt;Set&lt;String&gt;&gt; EMPTY_SET = Collections.unmodifiableSet(new HashSet&lt;Set&lt;String&gt;&gt;());

    static {
        synchronized (WORD_TO_SYNOYMYM_SETS) {
            load("data.adj");
            load("data.adv");
            load("data.verb");
            load("data.noun");
        }
    }

    private static void load(String path) {
        InputStream inputStream = null;
        BufferedReader reader = null;
        try {
            ClassLoader classLoader = Synonyms.class.getClassLoader();
            inputStream = classLoader.getResourceAsStream(path);
            reader = new BufferedReader(new InputStreamReader(inputStream));

            String line = null;
            while ((line = reader.readLine()) != null) {
                processLine(line);
            }
        } catch (IOException ioe) {
            throw new RuntimeException(ioe);
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException ioe) {
                }
            }

            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException ioe) {
                }
            }
        }
    }

    private static void processLine(String line) {
        if ((line.length() &gt; 17) &amp;&amp; (line.charAt(0) == '0')) {
            // the data we want starts at the 17th character
            line = line.substring(17);

            Set&lt;String&gt; synonymSet = new HashSet&lt;String&gt;();
            StringTokenizer st = new StringTokenizer(line, " ");
            while (st.hasMoreElements()) {
                String word = st.nextToken();

                if (word.startsWith("00")) {
                    break;
                }

                if (word.length() &gt; 2 &amp;&amp; Character.isLetter(word.charAt(0))) {
                    synonymSet.add(word);
                }
            }

            if (synonymSet.size() &gt; 1) {
                synonymSet = Collections.unmodifiableSet(synonymSet);
                for (String word : synonymSet) {
                    Set&lt;Set&lt;String&gt;&gt; synonymSetsForThisWord = WORD_TO_SYNOYMYM_SETS.get(word);
                    if (synonymSetsForThisWord == null) {
                        synonymSetsForThisWord = new HashSet&lt;Set&lt;String&gt;&gt;();
                        WORD_TO_SYNOYMYM_SETS.put(word, synonymSetsForThisWord);
                    }
                    synonymSetsForThisWord.add(synonymSet);
                }
            }
        }
    }

    public static Set&lt;Set&lt;String&gt;&gt; getSynonymSets(String word) {
        synchronized (WORD_TO_SYNOYMYM_SETS) {
            Set&lt;Set&lt;String&gt;&gt; synonymSets = WORD_TO_SYNOYMYM_SETS.get(word);
            return ((synonymSets != null) ? Collections.unmodifiableSet(synonymSets) : EMPTY_SET);
        }
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/blog.surfcanyon.com/p=105</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

