<?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>mitcho.com &#187; JavaScript</title>
	<atom:link href="http://mitcho.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://mitcho.com</link>
	<description></description>
	<lastBuildDate>Fri, 10 Feb 2012 23:24:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>Checking mochitest test coverage</title>
		<link>http://mitcho.com/blog/projects/checking-mochitest-test-coverage/</link>
		<comments>http://mitcho.com/blog/projects/checking-mochitest-test-coverage/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 23:05:19 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mochitest]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[Panorama]]></category>

		<guid isPermaLink="false">http://mitcho.com/?p=4253</guid>
		<description><![CDATA[One of the last bugs for Firefox Panorama was bug 625818: &#8220;Check Panorama mochitest test suite coverage&#8221;. Our automated tests ensure that we do not regress on existing functionality, but it&#8217;s only as good as its coverage: how much of the Panorama code base is actually being &#8220;hit&#8221; through the process of running the test [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/performance-vs-responsiveness/' rel='bookmark' title='Performance vs Responsiveness —or— How I Made the Parser Twice As Fast in One Day'>Performance vs Responsiveness —or— How I Made the Parser Twice As Fast in One Day</a></li>
<li><a href='http://mitcho.com/blog/how-to/develop-with-jetpack-sdk-0-2/' rel='bookmark' title='Beginning development with Jetpack SDK 0.2'>Beginning development with Jetpack SDK 0.2</a></li>
<li><a href='http://mitcho.com/blog/projects/keep-up-with-yet-another-related-posts-plugin-with-rss/' rel='bookmark' title='Keep up with Yet Another Related Posts Plugin with RSS!'>Keep up with Yet Another Related Posts Plugin with RSS!</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mozilla.org/firefox?WT.mc_id=aff_en08&amp;WT.mc_ev=click" style="float: right;margin-left:10px;"><img border="0" alt="Firefox Download Button" src="http://www.mozilla.org/contribute/buttons/120x240arrow_b.png"/></a>One of the last bugs for Firefox Panorama was <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=625818">bug 625818: &#8220;Check Panorama mochitest test suite coverage&#8221;</a>. Our automated tests ensure that we do not regress on existing functionality, but it&#8217;s only as good as its coverage: how much of the Panorama code base is actually being &#8220;hit&#8221; through the process of running the test suite.</p>

<p>Panorama went through a pretty rapid development cycle, making it into <a href="http://firefox.com">Firefox 4</a> which was <a href="http://blog.mozilla.com/blog/2011/03/22/mozilla-launches-firefox-4-and-delivers-a-fast-sleek-and-customizable-browsing-experience-to-more-than-400-million-users-worldwide-2/">released today</a> (yay!). Moreover, for a while we were developing outside of mozilla-central, without the regular &#8220;patches require tests&#8221; requirement. This makes checking its test coverage particularly important.</p>

<p>Check out the final result, the <a href="http://mitcho.com/code/panorama-coverage/">Panorama test coverage report</a>. The good news: our code coverage is 86%! (Some notes on what improvements can be made are in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=625818">the bug</a>.)</p>

<p><a href="http://mitcho.com/code/panorama-coverage/"><img src="http://mitcho.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-22-at-6.59.26-PM.png" alt="code coverage report" border="0" width="600" height="260" /></a></p>

<p>PhiliKON had previously worked on hooking into the <a href="https://developer.mozilla.org/en/Code_snippets/JavaScript_Debugger_Service">JS Debugger service</a>&#8217;s <code>interruptHook</code> to test <a href="https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests"><code>xpcshell</code> tests</a>. I modified this code to run instead in the <a href="https://developer.mozilla.org/en/Browser_chrome_tests">Mochitest browser chrome tests</a>. This code can be found <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=625818">on the bug</a>.</p>

<p>With this patch applied, I invoked the test suite with the following code: <code>TEST_PATH=browser/base/content/tests/tabview COVERAGE_FILTER="*tabview*" COVERAGE=true make -C obj-ff-dbg mochitest-browser-chrome</code> . That&#8217;s a regular <code>mochitest-browser-chrome</code> invocation with the <code>COVERAGE=true</code> flag which turns on code coverage checking, and <code>COVERAGE_FILTER=*tabview*</code> which filters out results from files which don&#8217;t have &#8220;tabview&#8221; in their paths. This creates a file called <code>coverage.json</code> in the working directory <em>of the test suite</em>, meaning, for me, <code>obj-ff-dbg/_tests/testing/mochitest/</code>.</p>

<p>This JSON file is a multidimensional array, with file paths and then line numbers as keys. The file paths here, as best as possible, have been converted into local filesystem paths. PhiliKON built a script which produces beautiful reports based on this output.</p>

<p>A word of warning: running with this JSD <code>interruptHook</code> is ridiculously slow. A number of tests for Panorama are timing-dependent (drag-drop tests, for example), making some of them fail, but that&#8217;s okay&#8230; as long as it completed not via a timeout, it actually did run through all the code. In order to get this to run through everything with some degree of control, I split up the mochitest tabview suite in to a few chunks. I then took the multiple resulting <code>coverage.json</code> files and passed them into another script, in <code>tools/coverage/aggregate.py</code>, which takes multiple JSON results like this and puts them together into a single JSON file. I then passed this aggregate JSON file to PhiliKON&#8217;s wonderful report script and—voila—the <a href="http://mitcho.com/code/panorama-coverage/">Panorama test coverage report</a>! Easy as pie.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/performance-vs-responsiveness/' rel='bookmark' title='Performance vs Responsiveness —or— How I Made the Parser Twice As Fast in One Day'>Performance vs Responsiveness —or— How I Made the Parser Twice As Fast in One Day</a></li>
<li><a href='http://mitcho.com/blog/how-to/develop-with-jetpack-sdk-0-2/' rel='bookmark' title='Beginning development with Jetpack SDK 0.2'>Beginning development with Jetpack SDK 0.2</a></li>
<li><a href='http://mitcho.com/blog/projects/keep-up-with-yet-another-related-posts-plugin-with-rss/' rel='bookmark' title='Keep up with Yet Another Related Posts Plugin with RSS!'>Keep up with Yet Another Related Posts Plugin with RSS!</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/checking-mochitest-test-coverage/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Spring is for Speaking: JSConf, WordCamp SF, IACL</title>
		<link>http://mitcho.com/blog/projects/spring-is-for-speaking/</link>
		<comments>http://mitcho.com/blog/projects/spring-is-for-speaking/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 04:37:04 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[Boston]]></category>
		<category><![CDATA[Chinese language]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[harvard]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Jetpack]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[Mandarin]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[San Francisco]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[Washington D.C.]]></category>
		<category><![CDATA[WordCamp]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Planet]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=3448</guid>
		<description><![CDATA[I recently confirmed three different very exciting speaking gigs which I&#8217;ll be doing this spring: JSConf.us: I&#8217;ll be putting my Mozilla Jetpack Ambassador hat on to represent Mozilla Labs&#8217; Jetpack project at the premier Javascript conference in North America, JSConf.us, which this year will be April 17-18 in Washington D.C. and has a pirate theme.1 [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/life/wordcamp-boston-2010/' rel='bookmark' title='WordCamp Boston 2010'>WordCamp Boston 2010</a></li>
<li><a href='http://mitcho.com/blog/projects/jetpacking-in-boston/' rel='bookmark' title='Jetpacking in Boston'>Jetpacking in Boston</a></li>
<li><a href='http://mitcho.com/blog/projects/mashing-up-the-browser-in-maine/' rel='bookmark' title='Mashing up the browser in Maine'>Mashing up the browser in Maine</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I recently confirmed three different very exciting speaking gigs which I&#8217;ll be doing this spring:</p>

<p><span id="more-3448"></span></p>

<p><strong>JSConf.us</strong>:</p>

<p>I&#8217;ll be putting my Mozilla Jetpack Ambassador hat on to represent Mozilla Labs&#8217; <a href="https://jetpack.mozillalabs.com/">Jetpack project</a> at the premier Javascript conference in North America, <a href="http://jsconf.us/2010/">JSConf.us</a>, which this year will be April 17-18 in Washington D.C. and has a pirate theme.<sup id="fnref:2"><a href="#fn:2" rel="footnote">1</a></sup> I&#8217;ll be giving a short talk in the main session and will also lead a hands-on Jetpack workshop in the hacker lounge. I&#8217;ve heard that JSConf is a lot of fun and I&#8217;m really looking forward to it! <img src='http://mitcho.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p><strong>WordCamp San Francisco</strong>:</p>

<p>I&#8217;m honored to have been invited to give a talk at <a href="http://2010.sf.wordcamp.org/">WordCamp San Francisco 2010</a>. WordCamps are community-organized events for the <a href="http://wordpress.org">WordPress</a> community, and the San Francisco WordCamp is the original and biggest. WordCamp SF will be at the Mission Bay Conference Center on May 1st. <a href="https://2010.sf.wordcamp.org/tickets/">Tickets available</a>.</p>

<p>My talk is tentatively titled &#8220;Abstract Your Code.&#8221;<sup id="fnref:1"><a href="#fn:1" rel="footnote">2</a></sup> WordPress is a great platform to build amazing content-rich applications on, and many of us have written new functionality in the form of plugins. I hope to encourage developers to make their code more portable and reusable after the project is done—or, ideally, to even start with abstraction in mind—to add to the &#8220;life&#8221; of the code and to consider then open-sourcing that functionality.</p>

<p>Hope to see you there!</p>

<p><strong>International Association of Chinese Linguistics (IACL) 18</strong>:</p>

<p>Finally, I&#8217;m thrilled to say that I got a paper accepted to the <a href="http://www.fas.harvard.edu/~iacl18/Site/index.html">annual meeting of the International Association of Chinese Linguistics</a> which this year is at Harvard on May 20-22. IACL is <em>the</em> big conference for Chinese linguistics, with about <a href="http://www.fas.harvard.edu/~IACL18/AcceptList.pdf">180 papers presenting</a>. I&#8217;ll be presenting <em>Two</em> Only<em>s in Mandarin Chinese</em>, my recent work on the formal syntax/semantics of two <em>only</em> words in Chinese: <em>zhǐ</em> (只) and <em>éryǐ</em> (而已). I&#8217;ve put up <a href="http://mitcho.com/academic/handout-20100226.pdf">a handout</a> of some of this material in work-in-progress form which I recently presented at <a href="http://people.fas.harvard.edu/~nicolae/SNEWS_2010/Welcome.html">SNEWS</a>.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:2">
<p>I&#8217;ll <a href="http://beijinghuar.com">fit right in</a>.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:1">
<p>Sexier title suggestions welcome.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/life/wordcamp-boston-2010/' rel='bookmark' title='WordCamp Boston 2010'>WordCamp Boston 2010</a></li>
<li><a href='http://mitcho.com/blog/projects/jetpacking-in-boston/' rel='bookmark' title='Jetpacking in Boston'>Jetpacking in Boston</a></li>
<li><a href='http://mitcho.com/blog/projects/mashing-up-the-browser-in-maine/' rel='bookmark' title='Mashing up the browser in Maine'>Mashing up the browser in Maine</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/spring-is-for-speaking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating an image-sized iframe overlay with Shadowbox</title>
		<link>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/</link>
		<comments>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 05:33:50 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MIT]]></category>
		<category><![CDATA[shadowbox]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=3293</guid>
		<description><![CDATA[I recently have been working with the Shadowbox JavaScript library for an upcoming revision to the MIT Edgerton Digital Collections website. Shadowbox is a nice lightbox library designed to work with various JavaScript libraries like jQuery, prototype, and mootools with a nice modular design. Shadowbox is organized around different &#8220;players&#8221;—one for each kind of media [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/life/im-seriously-dreaming-of-a-white-christmas/' rel='bookmark' title='I&#8217;m Seriously Dreaming of a White Christmas'>I&#8217;m Seriously Dreaming of a White Christmas</a></li>
<li><a href='http://mitcho.com/blog/life/the-gift-that-keeps-on-giving/' rel='bookmark' title='The Gift That Keeps On Giving'>The Gift That Keeps On Giving</a></li>
<li><a href='http://mitcho.com/blog/life/atayal-cultural-festival/' rel='bookmark' title='Atayal cultural festival'>Atayal cultural festival</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I recently have been working with the <a href="http://www.shadowbox-js.com/">Shadowbox</a> JavaScript library for an upcoming revision to the MIT <a href="http://edgerton-digital-collections.org">Edgerton Digital Collections</a> website. Shadowbox is a nice <a href="http://en.wikipedia.org/wiki/Lightbox (JavaScript)">lightbox</a> library designed to work with various JavaScript libraries like jQuery, prototype, and mootools with a nice modular design.</p>

<p>Shadowbox is organized around different &#8220;players&#8221;—one for each kind of media that will be displayed. The library by default comes with players for Flash, HTML fragments, <code>iframe</code>s, QuickTime, and Windows Media. Some of these players, like those for images and video, automatically recognize the media size and adjust the lightbox accordingly, while others such as the <code>iframe</code> player can use a set size or can fill the screen. For the Edgerton site, though, we had a need for displaying an <code>iframe</code> but in the dimensions of a set image, so that we could display the image with an overlay. Here are some notes on how to implement a custom player for Shadowbox.</p>

<p><span id="more-3293"></span>
The first step to getting Shadowbox to recognize a custom player is to modify the players loaded by <code>shadowbox.js</code>. I called my player &#8220;hybrid,&#8221; as it&#8217;s like a cross between the <code>iframe</code> and <code>img</code> players.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">Shadowbox.<span style="color: #660066;">options</span>.<span style="color: #660066;">players</span><span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;html&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;iframe&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;img&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;hybrid&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>


<p>Now Shadowbox will try to look for the file <code>players/shadowbox-hybrid.js</code>. That&#8217;s where we will create our custom player. Start by duplicating the <code>iframe</code> player file. Next, we can make one more change to <code>shadowbox.js</code>. In the <code>getPlayer</code> function, add a line that will return &#8220;<code>hybrid</code>&#8221; when it recognizes a lightbox which should use the hybrid player. I added the following line, which uses the hybrid player when the text &#8220;<code>galleries</code>&#8221; is in the <code>a</code> tag&#8217;s <code>href</code> attribute.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/galleries/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;hybrid&quot;</span><span style="color: #339933;">;</span></pre></div></div>


<p>Finally, you must actually write the new player. There&#8217;s a readme file which describes the interface:</p>

<blockquote>
<p>All players should implement the same interface. This makes it possible for the Shadowbox class to know what methods to call and properties to check on player objects.</p>
<p>The interface is described here, with some simple explanations of how each method and/or property is to be used.</p>
<dl>
<dt><strong>height</strong></dt>
    <dd>(Number) The height of the object (in pixels)</dd>
<dt><strong>width</strong></dt>
    <dd>(Number) The width of the object (in pixels)</dd>
<dt><strong>ready</strong></dt>
    <dd>(optional, Boolean) True if the content is ready to be loaded, false otherwise. Useful when the script should wait until the content loads before proceeding (see below)</dd>
<dt><strong>resizable</strong></dt>
    <dd>(optional, Boolean) True if the content can be dynamically resized by the script (e.g. images, but not most movie formats)</dd>
<dt><strong>append()</strong></dt>
    <dd>Appends this object to the DOM</dd>
<dt><strong>remove()</strong></dt>
    <dd>Removes this object from the DOM</dd>
<dt><strong>onLoad()</strong></dt>
    <dd>(optional) Called after the content is loaded and the loading layer is hidden</dd>
<dt><strong>onWindowResize()</strong></dt>
    <dd>(optional) Called when the window is resized</dd>
</dl>
</blockquote>

<p>I found these directions quite easy to follow. For our purposes, there was also a note on how to set an object&#8217;s height and width based on an image.</p>

<p>Hopefully these notes are helpful for others who hope to take full advantage of this very powerful JavaScript library.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/life/im-seriously-dreaming-of-a-white-christmas/' rel='bookmark' title='I&#8217;m Seriously Dreaming of a White Christmas'>I&#8217;m Seriously Dreaming of a White Christmas</a></li>
<li><a href='http://mitcho.com/blog/life/the-gift-that-keeps-on-giving/' rel='bookmark' title='The Gift That Keeps On Giving'>The Gift That Keeps On Giving</a></li>
<li><a href='http://mitcho.com/blog/life/atayal-cultural-festival/' rel='bookmark' title='Atayal cultural festival'>Atayal cultural festival</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/how-to/creating-an-image-sized-iframe-overlay-with-shadowbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mashing up the browser in Maine</title>
		<link>http://mitcho.com/blog/projects/mashing-up-the-browser-in-maine/</link>
		<comments>http://mitcho.com/blog/projects/mashing-up-the-browser-in-maine/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 19:00:32 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[travelogue]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Jetpack]]></category>
		<category><![CDATA[Maine]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[slides]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=3233</guid>
		<description><![CDATA[Last week I was invited to give a talk at the TechMaine annual conference in Portland, Maine. Being a longer time slot than I previously have used to talk about Ubiquity, I decided to dedicate a good portion of the talk to Jetpack. Being outside of Mozilla for the past few months, this gave me [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/extending-wordpress-talk-at-the-boston-wordpress-meetup/' rel='bookmark' title='Extending WordPress talk at the Boston WordPress Meetup'>Extending WordPress talk at the Boston WordPress Meetup</a></li>
<li><a href='http://mitcho.com/blog/projects/talking-ubiquity-in-japan-%e6%8b%a1%e5%bc%b5%e6%a9%9f%e8%83%bd%e5%8b%89%e5%bc%b7%e4%bc%9a%e3%81%ab%e3%81%a6%e7%99%ba%e8%a1%a8/' rel='bookmark' title='Talking Ubiquity in Japan: 拡張機能勉強会にて発表'>Talking Ubiquity in Japan: 拡張機能勉強会にて発表</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-presentation-at-tokyo-20/' rel='bookmark' title='Ubiquity presentation at Tokyo 2.0'>Ubiquity presentation at Tokyo 2.0</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Last week I was invited to give a talk at the <a href="http://www.techmaine.com/ac2009">TechMaine annual conference</a> in Portland, Maine.</p>

<p>Being a longer time slot than I previously have used to talk about Ubiquity, I decided to dedicate a good portion of the talk to <a href="http://jetpack.mozillalabs.com">Jetpack</a>. Being outside of Mozilla for the past few months, this gave me an opportunity to get reacquainted with the Jetpack APIs. I myself was impressed by how easy it was to develop a quick Jetpack. I ended up preparing two to live-code during the talk: one called <a href="http://jetpackgallery.mozillalabs.com/jetpacks/207">Helvetica</a> which, with one click, replaces all fonts on the current page with Helvetica; and <a href="http://jetpackgallery.mozillalabs.com/jetpacks/208">You Are Here</a> which uses an open API from <a href="http://ipinfodb.com/">IPinfoDB</a> to display the physical location of the domain you are currently visiting in the status bar. Both are now on the <a href="http://jetpackgallery.mozillalabs.com/">Jetpack Gallery</a>.</p>

<p><a rel='lightbox' href="http://mitcho.com/blog/wp-content/uploads/2009/12/youarehere.png"><img src="http://mitcho.com/blog/wp-content/uploads/2009/12/youarehere-inset.png" alt="" title="You Are Here" width="464" height="112" class="alignnone size-full wp-image-3237" /></a></p>

<p>Unfortunately there was a bit of a snowstorm leading up to the event, but there was still a nice turnout and I got to meet some fantastic people there. Ken Shoemake of <a href="http://en.wikipedia.org/wiki/slerp">slerp</a> and <a href="http://en.wikipedia.org/wiki/quaternion">quaternion</a> fame came up to me after my talk and said &#8220;the Ubiquity parser reminded me of the dancing bear&#8230; it&#8217;s less surprising that it works well as that it works at all.&#8221; <img src='http://mitcho.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I also enjoyed the other great presentations in the technology track, covering the <a href="http://www.nofluffjuststuff.com/conference/speaker/brian_sletten">virtues of REST</a> and basic iPhone development.</p>

<p><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/mitcho/mashup-the-browser-with-ubiquity-and-jetpack" title="Mashup the Browser with Ubiquity and Jetpack">Mashup the Browser with Ubiquity and Jetpack</a><object style="margin:0px" width="600" height="501"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=techmaine-091210174736-phpapp01&#038;stripped_title=mashup-the-browser-with-ubiquity-and-jetpack" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=techmaine-091210174736-phpapp01&#038;stripped_title=mashup-the-browser-with-ubiquity-and-jetpack" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="501"></embed></object></p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/extending-wordpress-talk-at-the-boston-wordpress-meetup/' rel='bookmark' title='Extending WordPress talk at the Boston WordPress Meetup'>Extending WordPress talk at the Boston WordPress Meetup</a></li>
<li><a href='http://mitcho.com/blog/projects/talking-ubiquity-in-japan-%e6%8b%a1%e5%bc%b5%e6%a9%9f%e8%83%bd%e5%8b%89%e5%bc%b7%e4%bc%9a%e3%81%ab%e3%81%a6%e7%99%ba%e8%a1%a8/' rel='bookmark' title='Talking Ubiquity in Japan: 拡張機能勉強会にて発表'>Talking Ubiquity in Japan: 拡張機能勉強会にて発表</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-presentation-at-tokyo-20/' rel='bookmark' title='Ubiquity presentation at Tokyo 2.0'>Ubiquity presentation at Tokyo 2.0</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/mashing-up-the-browser-in-maine/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Ubiquity Persistence Project: exploring a persistent Ubiquity in the toolbar</title>
		<link>http://mitcho.com/blog/projects/the-ubiquity-persistence-project/</link>
		<comments>http://mitcho.com/blog/projects/the-ubiquity-persistence-project/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 19:50:13 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[participate]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2781</guid>
		<description><![CDATA[It&#8217;s often hard to remember Ubiquity&#8217;s presence and keystroke without a visual reminder—even I often forget that I could use Ubiquity and end up going to a search engine or using the search bar for some quick lookup task. What if the Ubiquity input were in the toolbar and always visible? How would that affect [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/user-aided-disambiguation-a-demo/' rel='bookmark' title='User-Aided Disambiguation: a demo'>User-Aided Disambiguation: a demo</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
<li><a href='http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/' rel='bookmark' title='Exploring Command Chaining in Ubiquity: Part 1'>Exploring Command Chaining in Ubiquity: Part 1</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s often hard to remember Ubiquity&#8217;s presence and keystroke without a visual reminder—even I often forget that I could use Ubiquity and end up going to a search engine or using the search bar for some quick lookup task. <strong>What if the Ubiquity input were in the toolbar and always visible?</strong> How would that affect people&#8217;s use of Ubiquity? And what could we make that look like and how would it behave? Today we&#8217;re kicking off the Ubiquity Persistence Project, a new Ubiquity initiative to explore what a persistent Ubiquity might look like in the Firefox toolbar.</p>

<p><a rel='lightbox' href="http://mitcho.com/blog/wp-content/uploads/2009/08/Screen-shot-2009-08-20-at-12.48.43-PM.png" alt="The Persistence tool"><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/persistence-small.png" alt="persistence-small.png" border="0" width="650" height="484" /></a></p>

<p>In order to facilitate this discussion, we created the Persistence tool. With the Persistence tool you can quickly try out new design and interaction ideas, mocking things up with some simple <a href="http://jquery.com">jQuery</a>-powered JavaScript and CSS and see your changes live. The Persistence tool is bundled with our <a href="http://ubiquity.mozilla.com/xpi/ubiquity-latest-beta.xpi">latest Ubiquity beta</a> (install link).</p>

<p><object width="649" height="365"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6197526&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6197526&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="649" height="365"></embed></object></p>

<p><a href="http://vimeo.com/6197526">The Ubiquity Persistence Project: exploring a persistent Ubiquity in the toolbar</a> from <a href="http://vimeo.com/mitchoyoshitaka">mitcho</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<p>I just put together a screencast introducing the initiative, demoing the Persistence tool, as well as talking about this project&#8217;s relation to the ongoing work on <a href="http://wiki.mozilla.org/Taskfox">Taskfox</a>. We&#8217;ll look forward to your comments and designs! <img src='http://mitcho.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/user-aided-disambiguation-a-demo/' rel='bookmark' title='User-Aided Disambiguation: a demo'>User-Aided Disambiguation: a demo</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
<li><a href='http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/' rel='bookmark' title='Exploring Command Chaining in Ubiquity: Part 1'>Exploring Command Chaining in Ubiquity: Part 1</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/the-ubiquity-persistence-project/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Exploring Command Chaining in Ubiquity: Part 1</title>
		<link>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/</link>
		<comments>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 20:35:37 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[nountypes]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[verbs]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2760</guid>
		<description><![CDATA[Since the dawn of time people have been asking about command chaining in Ubiquity. If you have a translate command and an email command, it would be great to be able to, for example, translate hello to Spanish and email to Juanito. This is what we call command chaining or piping: in a single complex [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/link/command-chaining-with-oni/' rel='bookmark' title='Command Chaining with Oni?'>Command Chaining with Oni?</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Since the <a href="http://labs.mozilla.com/2008/08/introducing-ubiquity/">dawn of time</a> people have been asking about command chaining in Ubiquity. If you have a <code>translate</code> command and an <code>email</code> command, it would be great to be able to, for example, <code>translate hello to Spanish and email to Juanito</code>. This is what we call <strong>command chaining</strong> or <strong><a href="http://en.wikipedia.org/wiki/Pipeline_(Unix)">piping</a></strong>: in a single complex query, specifying multiple (probably two) actions and using the first&#8217;s output as the second&#8217;s input.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<p>Today I hope to cover some of the technical considerations required in implementing command chaining in Ubiquity, and I will follow up soon with a blog post on the linguistic considerations required as well.</p>

<p><span id="more-2760"></span></p>

<h3>Technical considerations: hooking the pipes together</h3>

<p>I&#8217;d first like to lay out some technical challenges and questions. These can be broken into two different categories: (1) how the parse and display of suggestions is affected and (2) how the execution is affected.</p>

<h4>Matching inputs and outputs</h4>

<p>We&#8217;ll first consider how command chaining may affect the parsing. Ubiquity commands each specify the types of argument inputs that it expects using different <strong>noun types</strong>, such as <code>noun_arb_text</code> which accepts anything, <code>noun_type_number</code> which accepts numbers, or <code>noun_type_language</code>, which takes the name of a language. For example, the <code>translate</code> verb takes maximally three arguments: a <code>noun_arb_text</code> object, a <code>noun_type_language</code> goal (the language to translate into), and a <code>noun_type_language</code> source (the source language). In implementing command chaining, it will be necessary to identify the appropriate noun types for the <em>output</em> of a command.</p>

<p>The first question we must address here is <strong>&#8220;what is the chaining output of a command&#8221;?</strong> Is it the preview text? Some text output from the execution?</p>

<p><a href='http://www.flickr.com/photos/joemud/2851415655/'><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/2851415655_1012a4cce0_o.jpg" alt="2851415655_1012a4cce0_o.jpg" border="0" width="650" height="226" /></a><br/><small><a href='http://www.flickr.com/photos/joemud/2851415655/'>Big fish eat da lil fish</a> by joemud, CC-SA-NC</small></p>

<p>To put this question into perspective, we note that Ubiquity commands can be broadly classified into two types: <strong>lookup</strong> and <strong>action execution</strong>. Here&#8217;s a classification which I believe to be exhaustive:<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p>

<table>
<tr><th>classification</th><th>preview</th><th>execution</th><th>example</th></tr>
<tr><td rowspan='4'>lookup</td><td rowspan='4'>data lookup</td><td>inserting result into page</td><td><code>translate</code></td></tr>
<tr><td>opening a website</td><td><code>weather</code>, most search commands</td></tr>
<tr><td>copying result to pasteboard</td><td><code>get email address</code></td></tr>
<tr><td>nothing</td><td><code></code></td></tr>
<tr><td>action</td><td>nothing (maybe a description<br/>of what the action will do)</td><td>an action which changes some state <br/>(in the browser or on the web)</td><td><code>quit firefox</code>, <code>email</code>, <code>twitter</code></td></tr>
</table>

<p>In light of this classification I believe we can say that lookup commands are much more likely to be the first verb in a command chain—conversely, chains such as <code>email hello to Blair and then do ...</code> or <code>twitter hello and then ...</code> are quite unlikely. What is much more likely is for the first verb to be a lookup function.</p>

<table>
<tr><th>first verb type</th><th>second verb type</th><th>example</th></tr>
<tr><td>lookup</td><td>action</td><td><code>translate this to Spanish and email to Aza</code></td>
<tr><td>lookup</td><td>lookup</td><td><code>translate this to English and then find it with Amazon</code></td>
<tr><td>action</td><td>action/lookup</td><td><i>no use case?</i></td>
</table>

<p>Thus in the same way that not all commands have a useful execution<sup id="fnref:3"><a href="#fn:3" rel="footnote">3</a></sup> <strong>perhaps only lookup commands will have a chainable output: the results of the lookup.</strong> Even with this restriction, we will most likely need to implement a new &#8220;chainable output&#8221; method or getter in these commands. This means that commands will need to opt-in to become chainable, but I believe this is a necessary evil.</p>

<p>The second question we must address is <strong>&#8220;when do we establish the noun type of a command&#8217;s chainable output?&#8221;</strong> One unsung but crucial feature of the way Ubiquity works now is that suggestions&#8217; previews are not computed until that suggestion is selected (except for the first suggestion, which in most skins gets previewed immediately). Should we wait for all of the first verbs&#8217; chainable output to be computed and then run them through the <a href="http://mitcho.com/blog/projects/judging-noun-types/">noun type detection system</a>? Or should verbs with chainable output also <em>a priori</em> specify what noun types their output will be?</p>

<p>Both of these approaches have their problems. If we compute the chainable output of the first verb, run a noun type detection on it and <em>then</em> suggest the full combination if it matches what the second verb was expecting, this will have clear performance implications, not to mention that it could greatly complicate our <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2">parsing algorithm</a>. While the latter approach doesn&#8217;t have these performance implications, it does mean that it will have to list (by name or reference) the noun types that will match its output, meaning that if a command author is unaware of someone else&#8217;s noun type, that chain will be impossible, even if the chainable output itself does indeed match that noun type. The <em>a posteriori</em> approach would never have this issue. <strong>What other benefits or problems do you forsee with either of these approaches? Is there another approach which avoids these pitfalls?</strong></p>

<h4>(A)synchronous composability</h4>

<p>Once we have the noun types, parsing, and suggestions down, all that remains is to compute the previews and implement the composite execution. Since the Ubiquity command manager already wraps the preview and execute functions in a wrapper to facilitate localization, among other uses, it would be easy to make the command manager <a href="http://www.croczilla.com/blog/16">compose asynchronous processes pseudo-synchronously</a>. No major changes should be necessary to do the previews and executions, though, again, there will be a performance cost.</p>

<h3>Conclusion</h3>

<p>There are a number of technical questions which must be answered, mostly in the parsing/suggesting stage. The key questions to answer are:</p>

<ol>
<li>What is the chaining output of a command?</li>
<li>When do we establish the noun type of a command&#8217;s chainable output?</li>
</ol>

<p>I&#8217;ll make another post soon on the linguistic considerations necessary in making command chaining happen in a <a href="http://mitcho.com/blog/projects/how-natural-should-a-natural-interface-be/">natural</a> fashion.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>We&#8217;re going to limit our discussion here to this restriction that the two verbs are not simply two simultaneous commands, but two commands which operate successively on an input, i.e., that it is true piping. This for example rules out input such as <code>google dogs and translate cat to Spanish</code>, as the second command&#8217;s execution does not semantically depend on the first&#8217;s execution. This (hopefully uncontroversial) decision also affects the linguistic considerations to be made in my next post.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>If you know of a command which doesn&#8217;t neatly fit into &#8220;lookup&#8221; or &#8220;action&#8221;, please let me know.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:3">
<p>I believe we should mark these no-execution lookup commands visually so the user does not expect anything to happen if they execute it. This is <a href="http://ubiquity.mozilla.com/trac/ticket/651">trac #651</a>.&#160;<a href="#fnref:3" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/link/command-chaining-with-oni/' rel='bookmark' title='Command Chaining with Oni?'>Command Chaining with Oni?</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Performance vs Responsiveness —or— How I Made the Parser Twice As Fast in One Day</title>
		<link>http://mitcho.com/blog/projects/performance-vs-responsiveness/</link>
		<comments>http://mitcho.com/blog/projects/performance-vs-responsiveness/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 06:16:54 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[response]]></category>
		<category><![CDATA[responsiveness]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2712</guid>
		<description><![CDATA[Since we launched Ubiquity 0.5, the issue of Parser 2 performance has been brought up over and over within the community. By virtue of having a more flexible and localizable design, Parser 2 was expected to be slower than our original parser, but its current implementation felt noticeably—perhaps unnecessarily—slow compared to Parser 1. Parser 2 [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/this-week-on-ubiquity-parser-the-next-generation/' rel='bookmark' title='This week on Ubiquity Parser: The Next Generation'>This week on Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Since we <a href="http://labs.mozilla.com/2009/07/ubiquity-0-5/">launched Ubiquity 0.5</a>, the issue of Parser 2 performance has been brought up <a href="http://groups.google.com/group/ubiquity-firefox/browse_thread/thread/b0dfa649dda77a2c#">over</a> and <a href="http://groups.google.com/group/ubiquity-firefox/browse_thread/thread/13bc9ade35c8b708#">over</a> within the community. By virtue of having a <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2">more flexible and localizable design</a>, Parser 2 was expected to be slower than our original parser, but its current implementation felt noticeably—perhaps unnecessarily—slow compared to Parser 1. Parser 2 performance has been identified as <a href="https://wiki.mozilla.org/Labs/Ubiquity/Meetings/2009-08-05_Weekly_Meeting#Notes">one of the blockers</a> for pushing Ubiquity 0.5+ to all of our 0.1.x users, and has thus been one of my recent foci.</p>

<h3>The short story:</h3>

<p>Inspired by some comments by <a href="http://theunfocused.net">Blair</a>, yesterday I was able to make significant (roughly 100%) performance gains in Parser 2, resulting in 40-60% faster parses, depending on the query. This change <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/rev/77156d689b26">has been committed</a> and will be released as part of our forthcoming minor update, Ubiquity 0.5.4. Yay!</p>

<p><span id="more-2712"></span></p>

<h3>The long story: asynchronous parsing</h3>

<p>Given that parsing in Ubiquity, combined with the post-parse of displaying suggestions, takes a good few dozen milliseconds, it is important to make sure it doesn&#8217;t block the main execution thread in order for the UI to stay responsive throughout. In other words, we needed to make it asynchronous.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<p>When we began work on Parser 2 a few months ago, <a href="http://theunfocused.net">Blair</a> stepped up to the plate to make it run asynchronously. For various reasons, the parser doesn&#8217;t run in a Worker thread for truer threading. Instead, what we did was to put the parser&#8217;s steps into a <a href="https://developer.mozilla.org/en/New_in_JavaScript_1.7#Generators_and_iterators">generator</a> called <code>_yieldingParse</code>. The keyword <code>yield</code> is scattered in points throughout this generator.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> _yieldingParse<span style="color: #009900;">&#40;</span>...<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// step 1</span>
  ...
  <span style="color: #660066;">yield</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// step 2</span>
  ...
  <span style="color: #009900;">&#123;</span>
    ...
    <span style="color: #660066;">yield</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  ...
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>


<p>We then iterate over a <code>_yieldingParse</code> object in a function called <code>doAsyncParse</code>. Each time we go invoke <code>doAsyncParse</code>, it invokes <code>next</code> which advances from the last <code>yield</code> point of the parse to the next one. <code>doAsyncParse</code> checks after each step whether we should <code>keepworking</code> or not and then asynchronously advances to the next step by calling itself with a <code>setTimeout</code>. (Note the code below is a simplification.)</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> parseGenerator <span style="color: #339933;">=</span> _yieldingParse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> doAsyncParse<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> ok <span style="color: #339933;">=</span> parseGenerator.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ok <span style="color: #339933;">&amp;&amp;</span> keepworking<span style="color: #009900;">&#41;</span>
    Utils.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span>doAsyncParse<span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// get this party started</span>
Utils.<span style="color: #660066;">setTimeout</span><span style="color: #009900;">&#40;</span>doAsyncParse<span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<p>The more often we <code>yield</code>, the more responsive the UI would be. However, there is a certain overhead to <code>yield</code>ing each time due to the <code>setTimeout</code>s we call. This point hit home when Blair told me the other day that the parser was much faster without any of the <code>setTimeout</code>s. Indeed, in my own testing running queries completely synchronously (replacing out all the <code>setTimeout</code>s), parses would run in roughly half the original time. However, by virtue of being completely synchronous, the parser would then completely lock up the UI.</p>

<p>I thus set out to strike a balance between performance and responsiveness by taking out and moving some of the <code>yield</code>s in our <code>_yieldingParse</code> (<a href="http://ubiquity.mozilla.com/trac/ticket/856">#856</a>).</p>

<h3>Tests, tests, tests</h3>

<p><a href='http://twitter.com/progrium/status/3273910705'><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/Screen-shot-2009-08-12-at-4.38.50-PM.png" alt="Screen shot 2009-08-12 at 4.38.50 PM.png" border="0" width="641" height="206" /></a></p>

<p>Keeping this in mind, I ran a number of tests as I proceeded with my &#8220;refactoring.&#8221;</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/notes1.jpg" alt="notes.jpg" border="0" width="649" height="327" /></p>

<p>Here are some final parse time results:<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/beforeafter1.png" alt="beforeafter.png" border="0" width="576" height="344" /></p>

<p>Four different queries (&#8220;hello to span&#8221;, &#8220;goo hello&#8221;, &#8220;22.7&#8221;, &#8220;tw as test&#8221; with a selection context of &#8220;hello world&#8221;) were run using each algorithm. The blue bar is the performance of the algorithm prior to adjustment of <code>setTimeout</code>s—that of Ubiquity 0.5.3. The gold bar is the time from a completely synchronous parse where all the <code>setTimeout</code>s were replaced. This algorithm completely locks up the UI, but is clearly the fastest, and should be seen as a baseline for all other yielding optimizations. The green bar is our new algorithm. As you can see, <strong>the parser is now roughly twice as fast.</strong></p>

<p>Moreover, the average time difference between <code>yield</code>s went from 0.7ms to 3.9ms which still should be no problem in terms of responsiveness.</p>

<h3>Cancellability</h3>

<p>This <code>doAsyncParse</code> is also the key for cancellability of the query. When a user changes the input or closes Ubiquity while a query is in progress, we want to cancel that query as soon as possible so the user and UI can advance. <code>keepworking</code> is set to false when the query is cancelled, so making sure that we <code>yield</code> early enough and often enough in the parse are important for issues like <a href="http://ubiquity.mozilla.com/trac/ticket/741">keystrokes being lost when typing too fast</a>.</p>

<p>While the parser was indeed <code>yield</code>ing often enough (in fact, more often than necessary) before, I noticed that our first <code>yield</code> was often 15-20&#160;ms into the parse. This was because step 1 of our parse derivation was happening outside of the <code>doAsyncParse</code> loop. By moving this into that loop, I was able to bring this initial synchronous time down to around 10&#160;ms. Of course, setting up the parse generator itself takes a little overhead, so this can never go down to 0, but perhaps this will improve <a href="http://ubiquity.mozilla.com/trac/ticket/741">the keystroke issue</a> as well. <strong>I&#8217;d love to get anecdotal feedback on whether this update improves the disappearing keystrokes issue from 0.5.4 users.</strong></p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>This is analogous to <a href="http://shawnwilsher.com/archives/279">a recent discussion of the asynchronous AwesomeBar</a>.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>A note on methodology: the Parser 2 Playpen (<a href="chrome://ubiquity/content/playpen.html">chrome://ubiquity/content/playpen.html</a>) was used for all testing and timing. All tests were in Firefox 3.5 on Mac OS X Leopard. My machine is a 2.4&#160;GHz Intel Core 2 Duo MacBook Pro. No other (non-OS/daemon) apps were running. No other tabs were open and no other add-ons were installed.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/this-week-on-ubiquity-parser-the-next-generation/' rel='bookmark' title='This week on Ubiquity Parser: The Next Generation'>This week on Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/performance-vs-responsiveness/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Converting your Ubiquity command to Ubiquity 0.5</title>
		<link>http://mitcho.com/blog/projects/converting-your-ubiquity-command-to-ubiquity-0-5/</link>
		<comments>http://mitcho.com/blog/projects/converting-your-ubiquity-command-to-ubiquity-0-5/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 12:15:37 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2521</guid>
		<description><![CDATA[Converting your Ubiquity command to Ubiquity 0.5 from mitcho on Vimeo. This video walks through the process of converting your Ubiquity commands to Ubiquity 0.5 with Parser 2. For more information, please consult the command conversion tutorial. Related posts: A Demonstration of Ubiquity Parser 2 Changes to Ubiquity Parser 2 and the Playpen Foxkeh demos [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/' rel='bookmark' title='A Demonstration of Ubiquity Parser 2'>A Demonstration of Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><object width="649" height="365"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5691107&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5691107&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="649" height="365"></embed></object><br /><a href="http://vimeo.com/5691107">Converting your Ubiquity command to Ubiquity 0.5</a> from <a href="http://vimeo.com/mitchoyoshitaka">mitcho</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<p>This video walks through the process of converting your Ubiquity commands to Ubiquity 0.5 with Parser 2. For more information, please consult <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2_API_Conversion_Tutorial">the command conversion tutorial</a>.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/' rel='bookmark' title='A Demonstration of Ubiquity Parser 2'>A Demonstration of Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/converting-your-ubiquity-command-to-ubiquity-0-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Visual Guide to Community Command Localization</title>
		<link>http://mitcho.com/blog/projects/a-visual-guide-to-community-command-localization/</link>
		<comments>http://mitcho.com/blog/projects/a-visual-guide-to-community-command-localization/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 22:11:30 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[Matt Mullenweg]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2475</guid>
		<description><![CDATA[A natural language interface is only &#8220;natural&#8221; if it&#8217;s in your natural language. With this mantra in mind, we&#8217;ve been making steady progress on the challenging problem of Ubiquity localization. The first fruit of this research is in the localization of the parser and bundled commands in Ubiquity 0.5. Here today is a visual guide [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-localization-update/' rel='bookmark' title='Ubiquity Localization Update'>Ubiquity Localization Update</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-commands-for-ubiquity-0-5/' rel='bookmark' title='Localizing Commands for Ubiquity 0.5'>Localizing Commands for Ubiquity 0.5</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-localization-whats-new-whats-next/' rel='bookmark' title='Ubiquity Localization: What&#8217;s New, What&#8217;s Next'>Ubiquity Localization: What&#8217;s New, What&#8217;s Next</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://mitcho.com/blog/projects/how-natural-should-a-natural-interface-be/">natural language interface</a> is only &#8220;natural&#8221; if it&#8217;s in your natural language. With this mantra in mind, we&#8217;ve been making steady progress on the challenging problem of <a href="http://ubiquity.mozilla.com">Ubiquity</a> localization. The first fruit of this research is in the localization of the parser and bundled commands <a href="http://mitcho.com/blog/projects/ubiquity-localization-whats-new-whats-next/">in Ubiquity 0.5</a>. Here today is a visual guide on command localization in Ubiquity and different options we can take in attacking the community command localization problem.<span id="more-2475"></span></p>

<h3>Command localization in Ubiquity 0.5</h3>

<p>A few important design decisions have already been made in implementing command localization in Ubiquity 0.5. The first was the choice of the <a href="http://en.wikipedia.org/wiki/gettext">gettext</a> po (portable object) file format. The po format is a de facto industry standard with many tools built for the format and this design choice hopefully lower the bar for prospective localizers.</p>

<p>Second, in order to simplify the matching of localizations and commands, we require that each command feed have one localization po file, rather than splitting the localizations of different commands across multiple po files.</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/dist.png" alt="dist.png" border="0" width="650" height="250" /></p>

<p>Finding the appropriate localization po file for a JavaScript command feed is very simple with bundled commands as the files are managed in our main repository so we know exactly where to find them. We just take the command feed&#8217;s filename sans extension—the <em>feed key</em>—and look for <code>localizations/</code><em>lang</em><code>/</code><em>feed key</em><code>.po</code>, where <em>lang</em> is the active language code. This gives us a simple one to one relationship between the JavaScript command feed source and the appropriate localization.</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/local.png" alt="local.png" border="0" width="650" height="218" /></p>

<h3>Background</h3>

<p>The ability of users to <a href="https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.5_Author_Tutorial">easily write their own Ubiquity commands</a> has always been a huge strength of the Ubiquity platform. Users can also &#8220;subscribe&#8221; to commands written by other users on other servers. In this case, local copies of those command sources are made.</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/distcmds.png" alt="distcmds.png" border="0" width="650" height="420" /></p>

<p>The <a href="http://ubiquity.mozilla.com/herd/">herd</a> was developed as a dynamic aggregator of community Ubiquity commands. The herd keeps its own copy of each command source. The herd groups mirrors of command feeds on multiple servers together as well, giving each unique command feed a unique ID.</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/herd.png" alt="herd.png" border="0" width="650" height="240" /></p>

<h3>Localizing distributed resources</h3>

<p>This distributed nature of the command feeds is exactly what complicates the localization of community commands. The original sources themselves are distributed, and we also want a community of localizers to be able to localize the commands—i.e., for the localizations to be (in some sense) distributed. Here I will present three options which I believe could be the basis for a winning solution, in order of more distributed to less distributed.</p>

<p>All three of these options have the property that localizations do not need to be &#8220;approved&#8221; or &#8220;managed&#8221; by the command author. For example, a possible standard where URL&#8217;s of localizations must be in the command feed is not considered. I believe this is a crucial property of any approach we decide on.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<h4>Option 1: a completely distributed option</h4>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/option1.png" alt="herd.png" border="0" width="650" height="300" /></p>

<p>In this option, localizers simply put the po files on their own servers (or some code snippet site such as github) and the user must then subscribe to those localizations much as they subscribe to commands now.</p>

<h4>Option 2: registration and discovery through the herd</h4>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/option2.png" alt="herd.png" border="0" width="650" height="400" /></p>

<p>In this option, localizers put po files up on their own servers and then register that po file&#8217;s URL with the herd. The herd keeps track of each command feed&#8217;s localizations in different languages.</p>

<h4>Option 3: localizations on the herd</h4>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/option3.png" alt="herd.png" border="0" width="650" height="340" /></p>

<p>In this option, po localizations are uploaded right onto the herd. The herd is the centralized repository of all localizations for each command feed.</p>

<h3>Users first</h3>

<p>In coming up with a criteria for judging different models of community command localization, I think it is helpful to think of the end-user experience. Right now to subscribe to a new command a user must find the command (perhaps via the herd) and click on the subscribe button, then in most cases confirm that they are aware of the possible dangers and confirm subscription.<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup> What work is required for a user to subscribe to a new command <em>and get it in their language</em>?</p>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/07/subscribe.png" alt="herd.png" border="0" width="650" height="40" /></p>

<p>Under option one, the user would somehow have to find the localization scattered someplace on the internet of their own accord, and then install that localization by themself. In my mind, this is clearly a no go. With options two or three, however, when a user subscribes to a command feed Ubiquity can check with the herd to see whether there are any localizations available. The localizations could be offered to the user or the localization for the currently active language could be automatically installed. There are, on the other hand, disadvantages to requiring a centralized authority, exemplified by the fact that the current iteration of the herd itself has often been down.</p>

<h3>Summary and a call for comments</h3>

<p>As laid out in this visual guide, I personally have a couple main criteria which I believe we should follow:</p>

<ol>
<li><strong>localization independence</strong>: Command authors should not have to manage their commands&#8217; localizations. (See footnote 1.)</li>
<li><strong>friendly discovery and subscription</strong>: Users should not have to go out and find localizations by themselves. Localizations should be offered to the user.</li>
</ol>

<p>With these criteria, I&#8217;m pretty sure the only logical conclusion is that we need some level of centralization, pointing to options two and three. <strong>If you think of another option which satisfies these criteria, or disagree with the criteria above, I would love to know.</strong> In addition, <strong>have you encountered similar problems of localizing distributed resources elsewhere? What worked there?</strong></p>

<p>If this problem has been solved before, there is no need to reinvent the wheel. As far as I can tell, however, this could be a particularly hairy problem.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>This strong view is based on my own experience as a <a href="http://mitcho.com/code/yarpp/">WordPress plugin author</a> and a subsequent conversation with <a href="http://en.wikipedia.org/wiki/Matt Mullenweg">Matt Mullenweg</a>. The WordPress plugin ecosystem requires that plugin authors orchestrate localizations and bundle them into releases. In the case of my plugin, this requires regular contact with over a dozen localizers.<br/>The case of WordPress plugins is actually much like that of Ubiquity commands&#8230; the plugins can be served on any server, distributed, but there is also a central repository, <a href="http://wordpress.org/extend/">wordpress.org/extend</a>.<br/>Matt and I agreed that if localizers could somehow localize plugins without going through the command author, most of whom produce their plugins by volunteering their time, the localization of plugins could be much more popular. Indeed, some localizers go ahead and publish po files for popular plugins, but those localizations are hard to find as there is no repository for the localizations either.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>As I&#8217;ve <a href="http://mitcho.com/blog/projects/friendlier-command-feed-subscription/">written before about Ubiquity&#8217;s command subscription</a>, there is much we can improve in this area of Ubiquity&#8217;s user experience.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-localization-update/' rel='bookmark' title='Ubiquity Localization Update'>Ubiquity Localization Update</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-commands-for-ubiquity-0-5/' rel='bookmark' title='Localizing Commands for Ubiquity 0.5'>Localizing Commands for Ubiquity 0.5</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-localization-whats-new-whats-next/' rel='bookmark' title='Ubiquity Localization: What&#8217;s New, What&#8217;s Next'>Ubiquity Localization: What&#8217;s New, What&#8217;s Next</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/a-visual-guide-to-community-command-localization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The (Shiretoko) Revolution Begins Now</title>
		<link>http://mitcho.com/blog/link/the-shiretoko-revolution-begins-now/</link>
		<comments>http://mitcho.com/blog/link/the-shiretoko-revolution-begins-now/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 01:15:43 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[link]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Mozilla Japan]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[Shiretoko]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2314</guid>
		<description><![CDATA[As many of you know, the upcoming Firefox 3.5 was code-named Shiretoko after the Shiretoko National Park on Japan&#8217;s northern island of Hokkaido. The Shiretoko Foundation and Mozilla Japan just launched a very cool open-web-powered promotional website, interFORest, together with a very powerful educational site, discovershiretoko.org/. I just went to interforest.org/ and registered for my [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/observation/attachment-ambiguity/' rel='bookmark' title='Attachment Ambiguity—or—when is the gyudon cheap?'>Attachment Ambiguity—or—when is the gyudon cheap?</a></li>
<li><a href='http://mitcho.com/blog/life/report-from-mozilla-party-jp-10/' rel='bookmark' title='Report from Mozilla Party JP 10!'>Report from Mozilla Party JP 10!</a></li>
<li><a href='http://mitcho.com/blog/projects/ten-grand-is-buried-there/' rel='bookmark' title='Ten Grand Is Buried There'>Ten Grand Is Buried There</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>As many of you know, the upcoming Firefox 3.5 was code-named Shiretoko after the <a href="http://en.wikipedia.org/wiki/Shiretoko National Park">Shiretoko National Park</a> on Japan&#8217;s northern island of Hokkaido. The Shiretoko Foundation and Mozilla Japan just launched a very cool open-web-powered promotional website, interFORest, together with a very powerful educational site, <a href="http://discovershiretoko.org/">discovershiretoko.org/</a>. I just went to <a href="http://interforest.org/">interforest.org/</a> and registered for my own virtual tree to be planted on the virtual Shiretoko Park. This tree banner will keep track of traffic through my site to the interFORest site and will grow this tree accordingly over time. You can then go to <a href="http://interforest.org">interforest.org</a> and see all the trees growing on the park. With your help, we can grow it into a forest!</p>

<p><small>If you are reading this through a feed reader or planet, click on the <a href="http://mitcho.com/blog/link/the-shiretoko-revolution-begins-now/">permalink</a> to view the banner embedded below:</small></p>

<iframe src='http://interFORest.org/banners/foxkeh/5863550b6f9e7aa185d6640742a5889723e134d8' width='200' height='200' scrolling='no' frameborder='0' marginwidth='0' marginheight='0' border='0'></iframe>

<p>Place one of these personalized canvas-powered virtual tree banners on your site to spread the word on Firefox 3.5, the Shiretoko Park and Foundation, and the power of open communities. All the cool kids are doing it. ^^</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/observation/attachment-ambiguity/' rel='bookmark' title='Attachment Ambiguity—or—when is the gyudon cheap?'>Attachment Ambiguity—or—when is the gyudon cheap?</a></li>
<li><a href='http://mitcho.com/blog/life/report-from-mozilla-party-jp-10/' rel='bookmark' title='Report from Mozilla Party JP 10!'>Report from Mozilla Party JP 10!</a></li>
<li><a href='http://mitcho.com/blog/projects/ten-grand-is-buried-there/' rel='bookmark' title='Ten Grand Is Buried There'>Ten Grand Is Buried There</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/link/the-shiretoko-revolution-begins-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubiquity Localization Update</title>
		<link>http://mitcho.com/blog/projects/ubiquity-localization-update/</link>
		<comments>http://mitcho.com/blog/projects/ubiquity-localization-update/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 10:35:23 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[gettext]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2219</guid>
		<description><![CDATA[As we move closer and closer to shipping a Ubiquity with there is still much work to be done, particularly in the area of localization. In a recent Ubiquity meeting we laid out the explicit localization goals and non-goals of as follows: Goals for 0.5 Parser 2 (on by default) underlying support for localization of [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/big-issues-and-small-issues-with-parser-2/' rel='bookmark' title='Big Issues and Small Issues with Parser 2'>Big Issues and Small Issues with Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-commands-and-nountypes/' rel='bookmark' title='Localizing Ubiquity: commands and nountypes'>Localizing Ubiquity: commands and nountypes</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>As we move closer and closer to shipping a Ubiquity with <a href="https://labs.mozilla.com/2009/05/ubiquity-05-call-for-participation/">there is still much work to be done</a>, particularly in the area of localization. <a href="https://wiki.mozilla.org/Labs/Ubiquity/Meetings/2009-05-27_Weekly_Meeting">In a recent Ubiquity meeting</a> we laid out the explicit localization goals and non-goals of as follows:</p>

<ul>
<li>Goals for 0.5

<ul>
<li>Parser 2 (on by default)</li>
<li>underlying support for localization of commands</li>
<li>localization of standard feed commands for a few languages</li>
<li>Parser 2 language files for those same languages</li>
</ul></li>
<li>Nongoals for 0.5

<ul>
<li>distribution/sharing of localizations</li>
<li>localization of nountypes </li>
</ul></li>
</ul>

<p>The overall goal for this release of Ubiquity is to come up with a format and standard for localization. Localizations in Ubiquity 0.5 will only apply to commands bundled with Ubiquity, and the localization files themselves will be distributed with Ubiquity. In a future release we will tackle the problem of localizations for <a href="https://ubiquity.mozilla.com/herd/">commands in the wild</a> and truly croud-source<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> this process.</p>

<p><span id="more-2219"></span></p>

<h3>Localization Architecture</h3>

<p>The localization of Ubiquity commands will use a <a href="http://en.wikipedia.org/wiki/gettext">gettext</a>-style approach where localization files list key-value pairs for different properties and messages of the commands. For Ubiquity 0.5, where we only deal with the standard command feeds bundled Ubiquity, we can simply place all the localization files in <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/file/tip/ubiquity/standard-feeds/localization"><code>ubiquity/standard-feeds/localization</code></a>. Localization files are organized by source feed, with one localization file per source feed, per language.</p>

<p>The localizable components of commands will include the <code>names</code>, <code>contributors</code>, and <code>help</code> properties, as well as any localizable strings in the command&#8217;s <code>preview()</code> and <code>execute()</code> methods. To make strings localizable in <code>preview()</code> and <code>execute()</code>, they must be wrapped in the localize function, <code>_()</code>.<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p>

<p>Other localizable components, like <code>names</code>, <code>contributors</code>, and <code>help</code> will not need to be wrapped in the <code>_()</code> function. In addition, as the localization files can only hold values of strings, for values such as names and contributors, the delimiter <code>|</code> can be used to delimit multiple values.</p>

<p><pre code='javascript'>zoom.names=ズーム|ズームして|ズームする|ズームしろ</pre></p>

<h3>The Localization Experience</h3>

<p><a href="https://ubiquity.mozilla.com/trac/ticket/739">One tool we have planned</a> to help kickstart the localization process is a tool that will automatically create a template of strings that need localization in a user&#8217;s commands. I took a first stab at this tool today. Clicking on the &#8220;get localization template&#8221; link next to each feed in the <a href="chrome://ubiquity/content/cmdlist.html">Ubiquity command list</a> will give you a template which you can then copy into a text file:</p>

<p><a class='limages' href='http://mitcho.com/blog/wp-content/uploads/2009/06/localization-template.png' rel='lightbox'><img src="http://mitcho.com/blog/wp-content/uploads/2009/06/localization-template-smaller.png" alt="localization-template-smaller.png" border="0" width="600" height="437" /></a></p>

<p>Additionally, instructions will later be added to this page to specify how and where to save localizations to test them or perhaps we can add a button that will automatically save it in the right location.</p>

<h3>Open Questions</h3>

<h4>Localization file formats</h4>

<p>There are two kinds of file formats for localizations we are considering: <a href="https://developer.mozilla.org/En/XUL_Tutorial/Property_Files"><code>.properties</code></a> and <code>.po</code>, the native <a href="http://en.wikipedia.org/wiki/gettext">gettext</a> format. As an example, here is the same key-value pair in the two formats:</p>

<h5><code>.properties</code>:</h5>

<p><pre># This is a comment
welcomeMessage=Hello, world!</pre></p>

<h5><code>.po</code>:</h5>

<p><pre>#. This is a comment (the . is actually optional)
msgid "welcomeMessage"
msgstr "Hello, world!"</pre></p>

<p>The advantage of <code>.properties</code> over <code>.po</code> is that Mozilla natively supports this format with an XUL/XPCOM interface called <a href="https://developer.mozilla.org/En/XUL/Stringbundle">stringbundle</a> and it is what is used to localize JavaScript in Firefox itself. We actually already have the <code>_()</code> localization function working with the properties file format, following <a href="http://www.xuldev.org/blog/?p=45">gomita&#8217;s great instructions</a> (Japanese) on how to load properties files in using Mozilla&#8217;s native <a href="https://developer.mozilla.org/En/XUL/Stringbundle">stringbundle</a> tools via JavaScript.</p>

<p>The advantage of <code>.po</code> over <code>.properties</code> is that it is the de-facto standard in localization, particularly in the UNIX world. Lots of great tools have been written for it. The adoption of <code>.po</code> could make Ubiquity localization more accessible for more people. Another advantage is that <code>.po</code> files can have keys with spaces, as I note below.</p>

<p>If we do opt to work with <code>.po</code> files, the two libraries I see out in the wild for dealing with <code>.po</code> files are <a href="http://code.google.com/p/gettext-js/">gettext-js</a> (MIT) and <a href="http://jsgettext.berlios.de/">jsgettext</a> (LGPL). While I haven&#8217;t looked at the libraries in depth yet, so far jsgettext seems to be the winner, as some sections of gettext-js require the use of the <a href="http://www.prototypejs.org/">prototype.js</a> library.</p>

<h4>A &#8220;key&#8221; question</h4>

<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/06/icanhaskeyplz.jpg" alt="icanhaskeyplz.jpg" border="0" width="650" height="416" /></p>

<p>In either file format, we need a unique way to refer to each localizable string—a key format. As each localization file refers to a command feed, the first collision we must avoid is the command name. With this in mind, we can come up with some trivial keys for the localizable properties: (here, consider the command <code>hello</code>)</p>

<ul>
<li><code>hello.names</code></li>
<li><code>hello.contributors</code></li>
<li><code>hello.help</code></li>
</ul>

<p>However, we run into difficulty when we try to come up with keys for the arbitrary text in <code>preview</code>s and <code>execute</code>s. For example, for a message like &#8220;Hello world!&#8221; in the preview, we could simply make the key <code>hello.preview.Hello world!</code> but this may be unruly and be prone to typos. In addition, in <code>.properties</code> files keys cannot have certain characters in them, like spaces, so we would have to make the key something like <code>hello.preview.Hello_world!</code> or, stripping symbols and standardizing case, <code>hello.preview.HELLO_WORLD</code>.</p>

<p>Keys could also get very long with this type of key format, although here again <code>.po</code> files may have an advantage as they can stay relatively more legible even with long keys. One option to deal with this would be to optionally supply a key argument to <code>_()</code> so that it is used instead of the automatic key. For example, suppose the <code>hello</code> command&#8217;s <code>preview()</code> included this code:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">_<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'This is a really long greeting message. Hello there!'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'longmessage'</span><span style="color: #009900;">&#41;</span></pre></div></div>


<p>then a localizer would only have to refer to <code>hello.preview.longmessage</code>, not <code>hello.preview.THIS_IS_A_REALLY_LONG_GREETING_MESSAGE_HELLO_THERE</code>.</p>

<p><a href="http://twitter.com/m_satyr">satyr</a> points out that some commands use another function to incorporate similar actions and messages in both <code>preview()</code> and <code>execute()</code>. In this case, he argues, it wouldn&#8217;t make sense to have to keep both localizations (<code>hello.preview.</code>&#8230; and <code>hello.execute.</code>&#8230;). He suggests that optional keys (mentioned above) could be used without the <code>preview.</code> or <code>execute.</code> infixes, as in <code>hello.longmessage</code>. By taking out the <code>preview</code> and <code>execute</code> namespacing in the localization keys, though, it becomes the command author&#8217;s responsibility to not accidentally use strings named &#8220;names&#8221;, &#8220;help&#8221;, etc. that will have unintended consequences.</p>

<h3>Conclusion</h3>

<p>I hope that this blog post gives people an idea of the progress we&#8217;ve made in the localization area and gets people thinking about the challenges we still face. <strong>We&#8217;d love to get your feedback on the localization format and process in Ubiquity, as well as the open problems of the file format and keys.</strong></p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>Or &#8220;cloud-source&#8221;&#8230; finally a Japanese accent joke that&#8217;s semantically stable!&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>This function currently also has the ability to do simple <a href="http://en.wikipedia.org/wiki/printf">printf</a>-formatted string replacements:<br/>
<pre code='javascript'>_('This is a %S.',['test'])</pre>
<br/>Whether this format will replace support for <code>CmdUtils.renderTemplate</code> remains to be seen and is definitely worthy of discussion. If we move away from <a href="https://developer.mozilla.org/En/XUL_Tutorial/Property_Files">properties files</a>, in particular, we may keep <code>renderTemplate()</code> in lieu of the <a href="http://en.wikipedia.org/wiki/printf">printf</a> format. Mozilla&#8217;s built-in <a href="https://developer.mozilla.org/En/XUL/Stringbundle">stringbundle handling</a> just gave us a fast and free implementation of <a href="http://en.wikipedia.org/wiki/printf">printf</a>-style replacement.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/big-issues-and-small-issues-with-parser-2/' rel='bookmark' title='Big Issues and Small Issues with Parser 2'>Big Issues and Small Issues with Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-commands-and-nountypes/' rel='bookmark' title='Localizing Ubiquity: commands and nountypes'>Localizing Ubiquity: commands and nountypes</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/ubiquity-localization-update/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Ubiquity presentation at Tokyo 2.0</title>
		<link>http://mitcho.com/blog/projects/ubiquity-presentation-at-tokyo-20/</link>
		<comments>http://mitcho.com/blog/projects/ubiquity-presentation-at-tokyo-20/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 09:54:13 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[life]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[bilingual]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[GoaP]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Japanese language]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[Tokyo]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2203</guid>
		<description><![CDATA[This past Monday I presented at Tokyo 2.0, Japan&#8217;s largest bilingual web/tech community. I presented as part of a session on The Web and Language, which I also helped organize. Other presenters included Junji Tomita from goo Labs, Shinjyou Sunao of Knowledge Creation, developers of the Voice Delivery System API, and Chris Salzberg of Global [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/life/notes-from-barcamp-tokyo-2009/' rel='bookmark' title='Notes from BarCamp Tokyo 2009'>Notes from BarCamp Tokyo 2009</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><img src="http://mitcho.com/blog/wp-content/uploads/2009/06/t2p01.png" alt="T2P0.PNG" border="0" width="211" height="120" /></p>

<p>This past Monday I presented at <a href="http://www.tokyo2point0.net/events/tokyo-20-25-the-web-language">Tokyo 2.0</a>, Japan&#8217;s largest bilingual web/tech community. I presented as part of a session on The Web and Language, which I also helped organize. Other presenters included Junji Tomita from <a href="http://labs.goo.ne.jp/intl/">goo Labs</a>, Shinjyou Sunao of <a href="http://www.knowlec.com/">Knowledge Creation</a>, developers of the <a href="http://www.vdsapi.ne.jp/">Voice Delivery System</a> API, and <a href="http://globalvoicesonline.org/author/chris-salzberg/">Chris Salzberg</a> of <a href="http://globalvoicesonline.org/">Global Voices Online</a> on community translation.</p>

<p>I just put together a video of my Ubiquity presentation, mixing <a href="http://www.ustream.tv/recorded/1625213">the audio recorded live</a> at the presentation together with a screencast of my slides for better visibility. The presentation is 10 minutes long and is bilingual, English and Japanese.</p>

<p><object width="649" height="365"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5091071&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5091071&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="649" height="365"></embed></object><br /><a href="http://vimeo.com/5091071">Ubiquity: Command the Web with Language 言葉で操作する Web</a> from <a href="http://vimeo.com/mitchoyoshitaka">mitcho</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<p><span id="more-2203"></span>
The event also coincided with <a href="http://www.linkedin.com/in/davemcclure">Dave McClure&#8217;s</a> <a href="http://www.geeksonaplane.com/">Geeks on a Plane</a> Asia tour, attracting even more interest to the event. In the end it was the largest Tokyo 2.0 event ever.</p>

<p>As I <a href="http://twitter.com/mitchoyoshitaka/status/1980687478">leave Tokyo next month</a>, I&#8217;ll be sad to not be able to continue to be a part of Tokyo 2.0. I&#8217;ve met a lot of fascinating people and learned a lot at the monthly events. I&#8217;ll definitely make sure to schedule them in in my future travels back to Japan and I highly recommend any of you who travel to Tokyo do so as well.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/' rel='bookmark' title='Changes to Ubiquity Parser 2 and the Playpen'>Changes to Ubiquity Parser 2 and the Playpen</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/life/notes-from-barcamp-tokyo-2009/' rel='bookmark' title='Notes from BarCamp Tokyo 2009'>Notes from BarCamp Tokyo 2009</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/ubiquity-presentation-at-tokyo-20/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Changes to Ubiquity Parser 2 and the Playpen</title>
		<link>http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/</link>
		<comments>http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:21:47 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2173</guid>
		<description><![CDATA[Here&#8217;s a quick screencast highlighting some of the changes to Parser 2 and the updated Parser 2 Playpen. This video should be particularly useful to people hoping to add their language to Parser 2. It&#8217;s also a good reference for Ubiquity core developers. Changes to Ubiquity Parser 2 + Playpen from mitcho on Vimeo. All [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/' rel='bookmark' title='A Demonstration of Ubiquity Parser 2'>A Demonstration of Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/' rel='bookmark' title='Adding Your Language to Ubiquity Parser 2'>Adding Your Language to Ubiquity Parser 2</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick screencast highlighting some of the changes to Parser 2 and the updated <a href="chrome://parser-demo/content/index.html">Parser 2 Playpen</a>. This video should be particularly useful to people hoping to <a href="http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/">add their language to Parser 2</a>. It&#8217;s also a good reference for Ubiquity core developers.</p>

<p><object width="649" height="365"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=5013787&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=5013787&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="649" height="365"></embed></object><br /><a href="http://vimeo.com/5013787">Changes to Ubiquity Parser 2 + Playpen</a> from <a href="http://vimeo.com/mitchoyoshitaka">mitcho</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<p>All the features covered, as with all Parser 2 features, require that you <a href="https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Development_Tutorial">get the latest Ubiquity code</a> from our Mercurial repository.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/' rel='bookmark' title='A Demonstration of Ubiquity Parser 2'>A Demonstration of Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/' rel='bookmark' title='Adding Your Language to Ubiquity Parser 2'>Adding Your Language to Ubiquity Parser 2</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/changes-to-ubiquity-parser-2-and-the-playpen/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Localizing Ubiquity: commands and nountypes</title>
		<link>http://mitcho.com/blog/projects/localizing-ubiquity-commands-and-nountypes/</link>
		<comments>http://mitcho.com/blog/projects/localizing-ubiquity-commands-and-nountypes/#comments</comments>
		<pubDate>Mon, 25 May 2009 02:56:14 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2100</guid>
		<description><![CDATA[Now that Parser 2 is in decent shape and a number of parsing problems in different languages have been tackled, the focus has now shifted to coming up with an approach for localizing Ubiquity commands and nountypes. At last week&#8217;s weekly Ubiquity meeting we had a great conversation on this subject, which then has continued [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/big-issues-and-small-issues-with-parser-2/' rel='bookmark' title='Big Issues and Small Issues with Parser 2'>Big Issues and Small Issues with Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-an-open-letter-to-linguists/' rel='bookmark' title='Localizing Ubiquity: an open letter to linguists'>Localizing Ubiquity: an open letter to linguists</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Now that <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2">Parser 2</a> is in decent shape and a number of parsing problems in different languages have been tackled, the focus has now shifted to coming up with an approach for localizing Ubiquity commands and nountypes. At last week&#8217;s weekly Ubiquity meeting we had a great conversation on this subject, which then has <a href="http://groups.google.com/group/ubiquity-i18n/browse_thread/thread/56b97b6ed10d0d1a">continued on the Google group</a>.</p>

<p>I&#8217;ve been framing this problem as two subproblems:</p>

<ol>
<li>What will be the data structure of localized commands/nountypes within Ubiquity?</li>
<li>How do we distribute/share these localizations?</li>
</ol>

<p>We&#8217;ve mostly been discussing the first problem, weighing the merits of unified objects (with different localized text as different JS properties) as opposed to a <a href="http://en.wikipedia.org/wiki/gettext">gettext</a>-style approach, and noting that our requirements for commands and nountypes may be different. I hope we can discuss the second issue more in the coming week.</p>

<p>Should everything go through the command author? Should localization be centralized through some web tool? Should it be completely distributed like commands currently are? <strong>I invite you to join us in this conversation on the <a href="http://groups.google.com/group/ubiquity-i18n">Google group</a>.</strong> ^^</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/big-issues-and-small-issues-with-parser-2/' rel='bookmark' title='Big Issues and Small Issues with Parser 2'>Big Issues and Small Issues with Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-an-open-letter-to-linguists/' rel='bookmark' title='Localizing Ubiquity: an open letter to linguists'>Localizing Ubiquity: an open letter to linguists</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/localizing-ubiquity-commands-and-nountypes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Start Panic!</title>
		<link>http://mitcho.com/blog/link/start-panic/</link>
		<comments>http://mitcho.com/blog/link/start-panic/#comments</comments>
		<pubDate>Mon, 11 May 2009 06:06:05 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[link]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2026</guid>
		<description><![CDATA[Just saw this nice demo of the a:visited browser history security issue in action. Visit startpanic.com and click &#8220;start&#8221; to see it in action. Read about how this security hole works here. Hopefully flashy demos like this will bring more attention to this issue. Related posts: Foxkeh demos Ubiquity Parser: The Next Generation Adding Your [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/' rel='bookmark' title='Adding Your Language to Ubiquity Parser 2'>Adding Your Language to Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Just saw this nice demo of the <code>a:visited</code> browser history security issue in action. Visit <a href="http://startpanic.com">startpanic.com</a> and click &#8220;start&#8221; to see it in action.</p>

<blockquote>
  <p><a href="http://startpanic.com"><img src="http://mitcho.com/blog/wp-content/uploads/2009/05/picture-21.png" alt="Picture 2.png" border="0" width="658" height="207" /></a></p>
</blockquote>

<p>Read about how this security hole works <a href="http://www.merchantos.com/makebeta/tools/spyjax/">here</a>. Hopefully flashy demos like this will bring more attention to this issue.</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/' rel='bookmark' title='Adding Your Language to Ubiquity Parser 2'>Adding Your Language to Ubiquity Parser 2</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/link/start-panic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding Your Language to Ubiquity Parser 2</title>
		<link>http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/</link>
		<comments>http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 11:44:20 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[how to]]></category>
		<category><![CDATA[argument structure]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[case marking]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[French]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[semantic roles]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1956</guid>
		<description><![CDATA[NOTE: This blog post has now been added to the Ubiquity wiki and is updated there. Please disregard this article and instead follow these instructions. You&#8217;ve seen the video. You speak another language. And you&#8217;re wondering, &#8220;how hard is it to add my language to Ubiquity with Parser 2?&#8221; The answer: not that hard. With [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p><strong>NOTE: This blog post has now been added to the Ubiquity wiki and is updated there. Please disregard this article and instead follow <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2/Localization_Tutorial">these instructions</a>.</strong></p>

<p>You&#8217;ve <a href="http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/">seen the video</a>. You speak another language. And you&#8217;re wondering, <strong>&#8220;how hard is it to add my language to Ubiquity with Parser 2?&#8221;</strong> The answer: <strong>not that hard.</strong> With a little bit of JavaScript and knowledge of and interest in your own language, you&#8217;ll be able to get at least rudimentary Ubiquity functionality in your language. Follow along in this step by step guide and please <a href="http://ubiquity.mozilla.com/trac/ticket/662">submit your (even incomplete) language files</a>!</p>

<p><em>As Ubiquity Parser 2 evolves, there is a chance that this specification will change in the future. Keep abreast of such changes on the <a href="http://ubiquity.mozilla.com/planet/">Ubiquity Planet</a> and/or <a href="http://mitcho.com/blog/">this blog</a> (<a href="http://mitcho.com/blog/feed/blog-only/">RSS</a>).</em></p>

<p><span id="more-1956"></span></p>

<h3>Set up your environment</h3>

<p>If you&#8217;re new to Ubiquity core development, you&#8217;ll want to first read the <a href="http://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Development_Tutorial">Ubiquity 0.1 Development Tutorial</a> to learn how to get a live copy of the Ubiquity repository using <a href="http://en.wikipedia.org/wiki/Mercurial">Mercurial</a>. Once you&#8217;ve set up your Firefox profile to use this development version, make sure to try changing the <code>extensions.ubiquity.parserVersion</code> value to 2 in <code>about:config</code> (as seen in <a href="(http://mitcho.com/blog/projects/a-demonstration-of-ubiquity-parser-2/)">this demo video</a>) to verify that Parser 2 is working for you.</p>

<p>As you read along, you may find it beneficial to follow along in the languages currently included in Parser 2: <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/en.js">English</a>, <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/ja.js">Japanese</a>, <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/pt.js">Portuguese</a>, and <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/sv.js">Swedish</a> (and the incomplete <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/zh.js">Chinese</a> and <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/fr.js">French</a>).</p>

<h3>The structure of the language file</h3>

<p>Each language in Parser 2 gets its own file which acts as a <a href="https://developer.mozilla.org/En/Using_JavaScript_code_modules">JavaScript module</a>. You&#8217;ll need to look up the <a href="http://en.wikipedia.org/wiki/List of ISO 639-1 codes">ISO 639-1 code for your language</a>&#8230; Here we&#8217;ll use English (code <code>en</code>) as an example here and the JavaScript language file would then be called <code>en.js</code> and go in the <code>/ubiquity/modules/parser/new/</code> directory of the repository.</p>

<p>Here is the basic template for a Ubiquity Parser 2 language file:</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> EXPORTED_SYMBOLS <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;makeEnParser&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> window<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// kick it chrome style</span>
  Components.<span style="color: #660066;">utils</span>.<span style="color: #003366; font-weight: bold;">import</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;resource://ubiquity/modules/parser/new/parser.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> makeEnParser<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> en <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Parser<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'en'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
...
&nbsp;
  <span style="color: #000066; font-weight: bold;">return</span> en<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<p>After lines 1-4 which set up the <a href="https://developer.mozilla.org/En/Using_JavaScript_code_modules">JavaScript module</a>, everything else is wrapped in a factory function called <code>makeLaParser</code> (for Latin) or <code>makeEnParser</code> (for English, <code>en</code>) or <code>makeFrParser</code> (for French, <code>fr</code>), etc. This function initializes the new <code>Parser</code> object (line 7) with the appropriate language code, sets a bunch of parameters (elided above) and returns it. That&#8217;s it!</p>

<p>Now let&#8217;s walk through some of the parameters you must set to get your language working. For reference, the properties the language parser object is required to have are: <code>branching</code>, <code>anaphora</code>, and <code>roles</code>.</p>

<h3>Identifying your branching parameter</h3>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  en.<span style="color: #660066;">branching</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'right'</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// or 'left'</span></pre></div></div>


<p>One of the first things you&#8217;ll have to set for your parser is <strong>the <code>branching</code> parameter</strong>. Ubiquity Parser 2 uses the branching parameter to decide which direction to look for an argument after finding a delimiter or &#8220;role marker&#8221; (most often, these are <a href="http://en.wikipedia.org/wiki/adposition">prepositions or postpositions</a>. For example, in English &#8220;from&#8221; is a delimiter for the <code>goal</code> role and its argument is on its right.</p>

<table>
<tr><td>&nbsp;</td><td>&nbsp;</td><td colspan='2' style='background: transparent url(http://mitcho.com/i/cccarrow-right.png) no-repeat right bottom'>&nbsp;</td></tr>
<tr><td><b>to</b></td><td>Mary</td><td><b>from</b></td><td>John</td></tr>
</table>

<p>So &#8220;John&#8221; is a possible argument for the <code>source</code> role, but &#8220;Mary&#8221; should not be. Ubiquity can figure this out because English has the property <code>en.branching = 'right'</code>.</p>

<p>In Japanese, on the other hand, the argument of a delimiter like から (&#8220;from&#8221;) is found on the left of that delimiter, so <code>en.branching = 'left'</code>.</p>

<table>
<tr><td colspan='2' style='background: transparent url(http://mitcho.com/i/cccarrow-left.png) no-repeat left bottom'>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>メアリー</td><td><b>-から</b></td><td>ジョン</td><td><b>-に</b></td></tr>
<tr><td>Mary</td><td><b>from</b></td><td>John</td><td><b>to</b></td></tr>
</table>

<p>In general, if your language has prepositions, you should use <code>.branching = 'right'</code> and if your language has postpositions, you can use <code>.branching = 'left'</code>.</p>

<p><strong>For more info</strong>:</p>

<ul>
<li>see <a href="http://en.wikipedia.org/wiki/Branching (linguistics)">branching</a> on Wikipedia.</li>
</ul>

<h3>Defining your roles</h3>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  en.<span style="color: #660066;">roles</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'goal'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'to'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'source'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'from'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'position'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'at'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'position'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'on'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'alias'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'as'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'instrument'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'using'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>role<span style="color: #339933;">:</span> <span style="color: #3366CC;">'instrument'</span><span style="color: #339933;">,</span> delimiter<span style="color: #339933;">:</span> <span style="color: #3366CC;">'with'</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>


<p>The second required property is the inventory of semantic roles and their corresponding delimiters. Each entry has a <code>role</code> from the <a href="http://mitcho.com/blog/projects/rolling-out-the-roles/">inventory of semantic roles</a> and a corresponding delimiter. Note that this mapping can be <a href="http://en.wikipedia.org/wiki/many-to-many (data model)">many-to-many</a>, i.e., each role can have multiple possible delimiters and different roles can have shared delimiters. Try to make sure to cover all of the roles in the <a href="http://mitcho.com/blog/projects/rolling-out-the-roles/">inventory of semantic roles</a>.</p>

<p><strong>For more info:</strong></p>

<ul>
<li><a href="http://mitcho.com/blog/projects/writing-commands-with-semantic-roles/">Writing commands with semantic roles</a></li>
<li><a href="http://mitcho.com/blog/projects/rolling-out-the-roles/">the proposed inventory of semantic roles</a></li>
<li>Wikipedia entry on <a href="http://en.wikipedia.org/wiki/thematic relations">thematic relations</a></li>
</ul>

<h3>Entering your anaphora (&#8220;magic words&#8221;)</h3>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  en.<span style="color: #660066;">anaphora</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;this&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;that&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;it&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;selection&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;him&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;her&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;them&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>


<p>The final required property is the <code>anaphora</code> property which takes a list of &#8220;magic words&#8221;. Currently there is no distinction between all the different <a href="http://en.wikipedia.org/wiki/deixis">deictic</a> <a href="http://en.wikipedia.org/wiki/anaphora (linguistics)">anaphora</a> which might refer to different things.</p>

<h3>Special cases</h3>

<p>Some special language features can be handled by overriding the default behavior from <code>Parser</code>. Many of these features are still in the works, however, so we&#8217;d love to get your comments!</p>

<h4>Languages with no spaces</h4>

<p>If your language does not delimit arguments (or words, more generally) with spaces, there will be a need to write a custom <code>wordBreaker()</code> function and set <code>usespaces = false</code> and <code>joindelimiter = ''</code>. For an example, please take a look at the <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/ja.js">Japanese</a> or <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/raw-file/08cf861ba79a/ubiquity/modules/parser/new/zh.js">Chinese</a>.</p>

<h4>Case marking languages</h4>

<p><strike>If you have a strongly <a href="http://en.wikipedia.org/wiki/grammatical case">case-marked</a> language, you&#8217;ll have to write some rules to identify those different cases in <code>wordBreaker()</code> and then add some extra <code>roles</code> for these case markers, but for a number of languages the current design does not allow an elegant solution for parsing such arguments. Updates to this issue will be posted to <a href="http://ubiquity.mozilla.com/trac/ticket/663">this trac ticket</a>.</p>

<p>In the mean time, however, if you could write a parser even with only the prepositions/postpositions in your language, that would be a great benefit in getting started in your language.</strike> <strong>UPDATE</strong>: a proposal on how to deal with strongly case-marked languages has been written here: <a href="http://mitcho.com/blog/projects/in-case-of-case/">In Case of Case&#8230;</a>.</p>

<h4>Stripping articles</h4>

<p>Some languages have some delimiters which combine with articles. For example, in French, the preposition &#8220;à&#8221; combines with the masculine definite article &#8220;le&#8221; but not &#8220;la&#8221;:</p>

<ol>
<li>à + la = à la</li>
<li>à + le = au</li>
</ol>

<p>You can add both &#8220;à&#8221; and &#8220;au&#8221; as delimiters of the <code>goal</code> role, but then you will get feminine arguments back with the determiner (e.g. &#8220;la table&#8221;) while masculine arguments would be parsed without a determiner (e.g. &#8220;chat&#8221;).</p>

<ol>
<li>&#8220;<b>à</b> la table&#8221; = &#8220;<b>to</b> the table&#8221;</li>
<li>&#8220;<b>au</b> chat&#8221; = &#8220;<b>to the</b> cat&#8221;</li>
</ol>

<p><strike>One possible solution to this is to write a custom <code>cleanArgument()</code> method. After arguments have been parsed and placed in their appropriate roles, each argument text (say, &#8220;la table&#8221; or &#8220;chat&#8221;) are passed to <code>cleanArgument()</code>. You can simply write a <code>cleanArgument()</code> to strip off any &#8220;la &#8221; at the beginning of the input and return it and both example inputs will get normalized arguments: &#8220;table&#8221; and &#8220;chat&#8221;, respectively.</strike> <strong>UPDATE</strong>: For more up-to-date information on how to deal with these types of articles, please see <a href="http://mitcho.com/blog/projects/solving-a-romantic-problem/">Solving a Romance Problem</a>.</p>

<h3>Test your parser</h3>

<p>Now you can go into <code>about:config</code> and change <code>extensions.ubiquity.language</code> to be your language code and restart. All the verbs and nountypes at this point will remain the same as in the English version, but it should obey the argument structure (the word order and delimiters) of your language.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> If you run into any trouble, feel free to ask for help on the <a href="http://groups.google.com/group/ubiquity-i18n">Ubiquity i18n listhost</a> or find me on the Ubiquity IRC channel (mitcho @ irc.mozilla.org#ubiquity). Of course, once you&#8217;re at a good stopping point, please <a href="http://ubiquity.mozilla.com/trac/ticket/662">contribute your language file to Ubiquity</a>!</p>

<h3>More to come&#8230;</h3>

<p>At this point, you&#8217;ve only localized the <a href="http://en.wikipedia.org/wiki/argument structure">argument structure</a> of your language&#8230; additional work will be required to localize the nountypes and verb names, which is <a href="http://groups.google.com/group/ubiquity-i18n/browse_thread/thread/ab4d876b1ea02d4">the subject of ongoing discussion</a>&#8230; <a href="http://groups.google.com/group/ubiquity-i18n">join the Google Group</a> to get in on the discussion!</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>At this point in time it&#8217;s also possible to test your parser at <code>chrome://parser-demo/content/index.html</code> if you make a couple other changes to your code&#8230; for more information, watch the <a href="http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/">Foxkeh demos Ubiquity Parser TNG</a> video. This option gives you more debug info as well.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
<li><a href='http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/' rel='bookmark' title='Foxkeh demos Ubiquity Parser: The Next Generation'>Foxkeh demos Ubiquity Parser: The Next Generation</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/how-to/adding-your-language-to-ubiquity-parser-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Command Chaining with Oni?</title>
		<link>http://mitcho.com/blog/link/command-chaining-with-oni/</link>
		<comments>http://mitcho.com/blog/link/command-chaining-with-oni/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 09:41:29 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[link]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[composition]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1952</guid>
		<description><![CDATA[There are two challenges to implementing so-called command chaining, but only one of them is choosing a linguistically appropriate structural standard and parsing it. The other is the underlying difficulty of processing each individual &#8220;clause&#8221; in sequence, asynchronously. Alex Fritze blogged about how a project like his own Oni could dramatically simplify this underlying process. [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-i18n-questions-to-ask/' rel='bookmark' title='Ubiquity i18n: questions to ask'>Ubiquity i18n: questions to ask</a></li>
<li><a href='http://mitcho.com/blog/observation/wheres-the-verb/' rel='bookmark' title='Where&#8217;s The Verb?'>Where&#8217;s The Verb?</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>There are two challenges to implementing so-called <a href="https://ubiquity.mozilla.com/trac/ticket/255">command chaining</a>, but only one of them is choosing a linguistically appropriate structural standard and parsing it. The other is the underlying difficulty of processing each individual &#8220;clause&#8221; in sequence, asynchronously. <a href="http://www.croczilla.com">Alex Fritze</a> blogged about how a project like his own <a href="http://www.croczilla.com/oni">Oni</a> could dramatically simplify this underlying process.</p>

<p><a href="http://www.croczilla.com/blog/16">Ubiquity, Oni, and Composability</a>:</p>

<blockquote>but I cannot instruct it to give me list of translated google results:

<pre>translate (google foo) to German  // doesn't work</pre>

Or email me the resulting list:

<pre>email(translate (google foo) to German) // doesn't work</pre>

&#8230;So how does Oni relate to this? Oni is a browser-based &#8220;embedded structured concurrency framework&#8221;. It allows you to write asynchronous code as if it was synchronous, adding back the kind-of composibility that is lost when juggling concurrent strands of execution (such as e.g. pending XMLHttpRequests) with &#8216;conventional&#8217; sequential languages.</blockquote>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-i18n-questions-to-ask/' rel='bookmark' title='Ubiquity i18n: questions to ask'>Ubiquity i18n: questions to ask</a></li>
<li><a href='http://mitcho.com/blog/observation/wheres-the-verb/' rel='bookmark' title='Where&#8217;s The Verb?'>Where&#8217;s The Verb?</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/link/command-chaining-with-oni/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Count command for Ubiquity</title>
		<link>http://mitcho.com/blog/projects/count-command-for-ubiquity/</link>
		<comments>http://mitcho.com/blog/projects/count-command-for-ubiquity/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 04:18:26 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1788</guid>
		<description><![CDATA[(This is primarily a blog post to test out Sandro&#8217;s plugin for embedding Ubiquity commands in WordPress. If you don&#8217;t see the &#8220;subscribe to command&#8221; come up, make sure you&#8217;re looking at the single page view.) A while back I created a count command for Ubiquity to count HTML elements on a page, so I&#8217;ll [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/friendlier-command-feed-subscription/' rel='bookmark' title='Friendlier command feed subscription'>Friendlier command feed subscription</a></li>
<li><a href='http://mitcho.com/blog/projects/selecting-from-ubiquity/' rel='bookmark' title='selecting from Ubiquity'>selecting from Ubiquity</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>(This is primarily a blog post to test out <a href="http://github.com/gialloporpora/wordpress-ubiquity-plugin/tree/master">Sandro&#8217;s plugin for embedding Ubiquity commands in WordPress</a>. If you don&#8217;t see the &#8220;subscribe to command&#8221; come up, make sure you&#8217;re looking at the <a href="http://mitcho.com/blog/projects/count-command-for-ubiquity/">single page view</a>.)</p>

<p>A while back I created a <code>count</code> command for Ubiquity to count HTML elements on a page, so I&#8217;ll share it here. The idea is super simple: select some text on your page and execute <code>count p</code> to get the number of paragraphs, or <code>count a</code> to get the number of links, or <code>count tr</code> to get the number of table rows. This is super useful when reading articles with charts or lists online and you want to know how many there are without doing something like copy-pasting into Excel.</p>

<p>The <code>count</code> command is built using jQuery so it can even understand targets like <code>p.class</code> or <code>a[href=...]</code>. Give it a try! ^^</p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/friendlier-command-feed-subscription/' rel='bookmark' title='Friendlier command feed subscription'>Friendlier command feed subscription</a></li>
<li><a href='http://mitcho.com/blog/projects/selecting-from-ubiquity/' rel='bookmark' title='selecting from Ubiquity'>selecting from Ubiquity</a></li>
<li><a href='http://mitcho.com/blog/projects/rolling-out-the-roles/' rel='bookmark' title='Rolling out the Roles'>Rolling out the Roles</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/count-command-for-ubiquity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scoring and Ranking Suggestions</title>
		<link>http://mitcho.com/blog/observation/scoring-and-ranking-suggestions/</link>
		<comments>http://mitcho.com/blog/observation/scoring-and-ranking-suggestions/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 07:17:26 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[observation]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[candidates]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[constraints]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[linguistics]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[Optimality Theory]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[ranking]]></category>
		<category><![CDATA[score]]></category>
		<category><![CDATA[suggestions]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1745</guid>
		<description><![CDATA[I just spent some time reviewing how Ubiquity currently ranks its suggestions in relation to to Parser The Next Generation so I thought I&#8217;d put some of these thoughts down in writing. The issue of ranking Ubiquity suggestions can be restated as predicting an optimal output given a certain input and various conflicting considerations. Ubiquity [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-in-firefox-japanese/' rel='bookmark' title='Ubiquity in Firefox: Focus on Japanese'>Ubiquity in Firefox: Focus on Japanese</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I just spent some time reviewing how Ubiquity currently ranks its suggestions in relation to to <a href="https://wiki.mozilla.org/User:Mitcho/ParserTNG">Parser The Next Generation</a> so I thought I&#8217;d put some of these thoughts down in writing.</p>

<p>The issue of ranking Ubiquity suggestions can be restated as predicting an optimal output given a certain input and various conflicting considerations. Ubiquity (1.8, as of this writing) computes four &#8220;scores&#8221; for each suggestion:</p>

<p><span id="more-1745"></span></p>

<ol>
<li><code>duplicateDefaultMatchScore</code>: 100 by default—lowered if an unused argument gets multiple suggestions (in <a href="https://ubiquity.mozilla.com/hg/ubiquity-firefox/file/0aaeae361c33/ubiquity/modules/parser/parser.js#l558">the words of the code</a>: &#8220;reduce the match score so that multiple entries with the same verb are only shown if there are no other verbs.&#8221;)</li>
<li><code>frequencyMatchScore</code>: a score from the <code>suggestion memory</code> of the frequency of the suggestion&#8217;s verb, given the input verb (currently the first word) or nothing, in the case of noun-first suggestions</li>
<li><code>verbMatchScore</code>: float in [0,1]: (as described <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_Documentation#Scoring_the_Quality_of_the_Verb_Match">here</a>)

<ul>
<li>0.75 is returned in case there it is a noun-first suggestion (by virtue of the fact that <code>String.indexOf('')==0</code>)</li>
<li>1 if the verb name is equivalent across input-output</li>
<li>in [0.75,1) if the input is a prefix of the suggestion verb name</li>
<li>in [0.5,0.75) if the input is a non-prefix substring of the suggestion verb</li>
<li>in [0.25,0.5] if the input is a prefix of one of the <code>synonyms</code></li>
<li>in [0,0.25) if the input is a non-prefix substring of one of the <code>synonyms</code></li>
</ul></li>
<li><code>argMatchScore</code>: the number of arguments with matching &#8220;specific&#8221; nountypes, where &#8220;specific&#8221; is designated by the nountype having property <code>rankLast=false</code>.</li>
</ol>

<p>With the numeric scores for each of these criteria, a partial order of suggestions is constructed using a <a href="http://en.wikipedia.org/wiki/lexicographic order">lexicographic order</a>: that is, compare candidates first using <code>duplicateDefaultMatchScore</code>, break ties using <code>frequencyMatchScore</code>, if still tied break using <code>verbMatchScore</code>, and if still tied break using <code>argMatchScore</code>. This paradigm of constraints is called &#8220;strictly ranked&#8221; and a corollary of this is that lower constraints, no matter how well you score on them, can never overcome a loss at a higher constraint. A crucial corollary of this system is that lower constraints&#8217; scores need not be computed if a higher constraint already dooms it to a lower position.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<h3>Ranking in The Next Generation</h3>

<p>One of the goals of <a href="https://wiki.mozilla.org/User:Mitcho/ParserTNG">Parser The Next Generation</a> is to make noun/argument-first input first-class citizens of Ubiquity, improving their suggestions in particular to the benefit of <a href="http://mitcho.com/blog/projects/ubiquity-in-firefox-japanese/">verb-final languages</a>. Arguments will be split up and tested against different noun types before a verb is even entered into the input, in which case target verbs can be ranked according to the appropriateness of the input&#8217;s arguments. As such, I believe the <code>argMatchScore</code> criteria above should either be ranked higher in a strictly ranked model or be allowed to overtake lower scores for the higher constraints in a non-strictly ranked model.</p>

<p>The <a href="https://wiki.mozilla.org/User:Mitcho/ParserTNG">Parser The Next Generation</a> proposal and <a href="http://mitcho.com/code/ubiquity/parser-demo">demo</a> currently orders using a product of various criteria&#8217;s scores, rather than a lexicographic order of strictly ranked constraints. The component factors are:</p>

<ol>
<li><code>0.5</code> for parses where the verb was suggested</li>
<li><code>0.5</code> for each extra (>1) <code>object</code> argument (essentially &#8220;unused words&#8221; in the previous parser)</li>
<li>the score of each argument against that semantic role&#8217;s target noun type</li>
<li><code>0.8</code> for each unset argument of that verb</li>
</ol>

<p>Each component score is a value in [0,1], so the score is always non-decreasing across the derivation. This offers a natural way to optimize the candidate set creation: if a possible parse ever gets a score below a magic &#8220;threshold&#8221; value, it is immediately thrown away.</p>

<p>A possible problem with the current Parser TNG scoring model is that it will implicitly hinder verbs and parses with more arguments as it could have more sub-1 noun type score factors—this consideration may be great enough that a weighted additive model should be considered over a multiplicative one.</p>

<p><strong>How do you think we can make Ubiquity&#8217;s suggestion ranking smarter? What other factors should be considered, and what factors could be left out?</strong></p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>For all the linguists in the audience, if this sounds like <a href="http://en.wikipedia.org/wiki/Optimality Theory">Optimality Theory</a>, you would be right—there&#8217;s a little bit of <a href="http://roa.rutgers.edu/view.php3?roa=537">Prince and Smolensky (1993)</a> hanging out <a href="http://ubiquity.mozilla.com">in your browser</a>.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-in-firefox-japanese/' rel='bookmark' title='Ubiquity in Firefox: Focus on Japanese'>Ubiquity in Firefox: Focus on Japanese</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/observation/scoring-and-ranking-suggestions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Foxkeh demos Ubiquity Parser: The Next Generation</title>
		<link>http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/</link>
		<comments>http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 10:10:43 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[contribute]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[Foxkeh]]></category>
		<category><![CDATA[French]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1725</guid>
		<description><![CDATA[I just made a screencast with Foxkeh to demo the Ubiquity next generation parser demo and to demonstrate how easy it is to add your own language. Foxkeh wants you to localize the parser into your language. How could you say no? ^^ Foxkeh demos Ubiquity Parser: The Next Generation from mitcho on Vimeo. There [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/this-week-on-ubiquity-parser-the-next-generation/' rel='bookmark' title='This week on Ubiquity Parser: The Next Generation'>This week on Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-an-open-letter-to-linguists/' rel='bookmark' title='Localizing Ubiquity: an open letter to linguists'>Localizing Ubiquity: an open letter to linguists</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I just made a screencast with <a href="http://foxkeh.jp">Foxkeh</a> to demo the <a href="http://mitcho.com/code/ubiquity/parser-demo/">Ubiquity next generation parser demo</a> and to demonstrate how easy it is to add your own language. Foxkeh wants you to localize the parser into your language. How could you say no? ^^</p>

<p><object width="649" height="365"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3954284&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3954284&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="649" height="365"></embed></object><br /><a href="http://vimeo.com/3954284">Foxkeh demos Ubiquity Parser: The Next Generation</a> from <a href="http://vimeo.com/mitchoyoshitaka">mitcho</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

<p>There are some details which are not covered in this introductory video, such as how to deal with case marking languages or languages without spaces. Hopefully this&#8217;ll inspire some people to play with the demo, though. <strong>I&#8217;d love to hear your comments! ^^</strong></p>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/this-week-on-ubiquity-parser-the-next-generation/' rel='bookmark' title='This week on Ubiquity Parser: The Next Generation'>This week on Ubiquity Parser: The Next Generation</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
<li><a href='http://mitcho.com/blog/projects/localizing-ubiquity-an-open-letter-to-linguists/' rel='bookmark' title='Localizing Ubiquity: an open letter to linguists'>Localizing Ubiquity: an open letter to linguists</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/foxkeh-demos-ubiquity-parser-the-next-generation/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

