<?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>Jun Araki's Blog</title>
	<atom:link href="http://junaraki.net/blog/en/feed" rel="self" type="application/rss+xml" />
	<link>http://junaraki.net/blog/en</link>
	<description></description>
	<lastBuildDate>Sat, 24 Mar 2012 03:14:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My Life in Pittsburgh</title>
		<link>http://junaraki.net/blog/en/2012/03/10/470.html</link>
		<comments>http://junaraki.net/blog/en/2012/03/10/470.html#comments</comments>
		<pubDate>Sat, 10 Mar 2012 20:53:28 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Studying Abroad]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=470</guid>
		<description><![CDATA[Today I will write a little about my life here in Pittsburgh, PA with some pictures. Pittsburgh is the third place for me to live in the U.S. I have just remembered that I wrote a post about my life in the first place (Berkeley, CA), and one about my life in the second place [...]]]></description>
			<content:encoded><![CDATA[<p>Today I will write a little about my life here in Pittsburgh, PA with some pictures.  Pittsburgh is the third place for me to live in the U.S.  I have just remembered that I wrote a <a href="http://junaraki.net/blog/en/2009/08/09/120.html">post</a> about my life in the first place (Berkeley, CA), and <a href="http://junaraki.net/blog/en/2009/09/03/174.html">one</a> about my life in the second place (Palo Alto, CA) before.  I have been around in Pittsburgh for approximately seven months since I moved from California last August.  This period was really hectic for me to get used to everything, but even so, I have found a couple of things that I like about Pittsburgh.</p>
<p>The first one is that Pittsburgh has a good public transportation system, particularly the bus service provided by the <a href="http://www.portauthority.org/">Port Authority of Allegheny County</a>.  They have such many bus lines that I can use them for various purposes, including my commute to Carnegie Mellon University (CMU).  Although Stanford University provides <a href="http://transportation.stanford.edu/marguerite/">shuttle service</a> comparable to the <a href="http://www.cmu.edu/police/shuttleandescort/">similar one</a> by CMU, I didn&#8217;t find such convenience in public bus service around Stanford.</p>
<p>The weather in Pittsburgh is also unexpectedly benign.  It is colder in Pittsburgh than in California, of course.  We do have some snow in winter, but by and large it has been exceptionally warm this winter.  I will show you some pictures of Pittsburgh below.</p>
<p>These days I have been gearing up for the <a href="http://www.lti.cs.cmu.edu/education/phdprogram.shtml">Ph.D. program</a> of the <a href="http://www.lti.cs.cmu.edu/">Language Technologies Institute</a> at CMU, which I will be enrolling in this August.  While making efforts to prepare for the program, I would like to find more goodness and fun here in Pittsburgh for a change.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0575.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0575-300x225.jpg" alt="" title="CIMG0575" width="300" height="225" class="alignnone size-medium wp-image-480" /></a><br />
The Gates-Hillman Centers where I currently work.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0567.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0567-225x300.jpg" alt="" title="CIMG0567" width="225" height="300" class="alignnone size-medium wp-image-481" /></a><br />
The Cathedral of Learning at the University of Pittsburgh.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0566.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0566-225x300.jpg" alt="" title="CIMG0566" width="225" height="300" class="alignnone size-medium wp-image-482" /></a><br />
The Heinz Memorial Chapel close to the Cathedral of Learning.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0611.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0611-300x225.jpg" alt="" title="CIMG0611" width="300" height="225" class="alignnone size-medium wp-image-483" /></a><br />
A spacious and gentle slope on campus at Chatham University.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0572.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2012/03/CIMG0572-300x225.jpg" alt="" title="CIMG0572" width="300" height="225" class="alignnone size-medium wp-image-490" /></a><br />
A scene in the Pittsburgh downtown area.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2012/03/10/470.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Libtree 0.1 released</title>
		<link>http://junaraki.net/blog/en/2011/06/20/454.html</link>
		<comments>http://junaraki.net/blog/en/2011/06/20/454.html#comments</comments>
		<pubDate>Mon, 20 Jun 2011 08:37:14 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=454</guid>
		<description><![CDATA[A tree is one of the most important and fundamental data structures in computer science. It is so fundamental that I have so far come across that data structure in my research and various classes quite frequently. As such, I have decided to release my own Java implementation of an abstract tree data structure and [...]]]></description>
			<content:encoded><![CDATA[<p>A tree is one of the most important and fundamental data structures in computer science.  It is so fundamental that I have so far come across that data structure in my research and various classes quite frequently.  As such, I have decided to release my own Java implementation of an abstract tree data structure and some associated operations that I think might be useful in different situations.  You can see more information about the implementation, and download the code in the following web page: <a href="http://junaraki.net/software/libtree/">http://junaraki.net/software/libtree/</a> .  I made the initial release as simple as possible, and the essential code just involves five Java files; I&#8217;m planning to enhance the software little by little as well as its documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2011/06/20/454.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The commencement at Stanford</title>
		<link>http://junaraki.net/blog/en/2011/06/16/446.html</link>
		<comments>http://junaraki.net/blog/en/2011/06/16/446.html#comments</comments>
		<pubDate>Thu, 16 Jun 2011 12:44:07 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Studying Abroad]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=446</guid>
		<description><![CDATA[Last Sunday I attended the 120th Stanford Commencement at the Stanford Stadium. This was the first time that I attended a commencement in the U.S. The stadium was filled with students&#8217; families and friends, and I really felt great when standing in the field. The commencement had a hopeful atmosphere along with California&#8217;s typical sunny [...]]]></description>
			<content:encoded><![CDATA[<p>Last Sunday I attended the <a href="http://commencement.stanford.edu/">120th Stanford Commencement</a> at the Stanford Stadium. This was the first time that I attended a commencement in the U.S. The stadium was filled with students&#8217; families and friends, and I really felt great when standing in the field. The commencement had a hopeful atmosphere along with California&#8217;s typical sunny weather.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2011/06/cimg0410.jpg"><img class="alignnone size-medium wp-image-447" title="cimg0410" src="http://junaraki.net/blog/en/wp-content/uploads/2011/06/cimg0410-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>On the same day, I also attended the <a href="http://www-cs.stanford.edu/content/commencement">Computer Science Departmental diploma ceremony</a> on the lawn of the Gates Building. I received a diploma of Master of Science in computer science. The very moment of the reception was the most impressive to me on that day. I got a little tan with the sunny weather, by the way.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2011/06/16/446.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing something into a text file with Java</title>
		<link>http://junaraki.net/blog/en/2010/10/27/412.html</link>
		<comments>http://junaraki.net/blog/en/2010/10/27/412.html#comments</comments>
		<pubDate>Thu, 28 Oct 2010 01:22:33 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=412</guid>
		<description><![CDATA[In relation to a previous post about the code for reading a text file with Java, I will attach another (trivial) code for writing something into a text file. This post is also just for future reference. I have confirmed that it works with Java 1.6.0_18.]]></description>
			<content:encoded><![CDATA[<p>In relation to a <a href="http://junaraki.net/blog/en/2010/02/20/270.html">previous post</a> about the code for reading a text file with Java, I will attach another (trivial) code for writing something into a text file.  This post is also just for future reference.  I have confirmed that it works with Java 1.6.0_18.</p>
<pre class="brush: java; title: ; notranslate">
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.FileNotFoundException;
import java.io.IOException;

class SomeClass {
    public static void writeFile(String filename) {
        BufferedWriter fout = null;

        try {
            fout = new BufferedWriter(new FileWriter(filename));

            while (/* Some condition */) {
                // Write something.
                StringBuffer lineBuffer = new StringBuffer();
                lineBuffer.append(&quot;abc&quot;);
                lineBuffer.append(&quot;def&quot;);

                fout.write(lineBuffer.toString());
                fout.newLine();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (fout != null) fout.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String args[]) {
        writeFile(&quot;sample.txt&quot;);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/10/27/412.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Point Reyes National Seashore</title>
		<link>http://junaraki.net/blog/en/2010/09/19/389.html</link>
		<comments>http://junaraki.net/blog/en/2010/09/19/389.html#comments</comments>
		<pubDate>Sun, 19 Sep 2010 19:54:43 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=389</guid>
		<description><![CDATA[I took a one day trip to Point Reyes National Seashore for my break yesterday, the Saturday right before the autumn quarter begins. For some reason I wanted to see the Pacific ocean; I occasionally feel like seeing some spacious sceneries for a change. Point Reyes National Seashore is one of the park preserves that [...]]]></description>
			<content:encoded><![CDATA[<p>I took a one day trip to <a href="http://www.nps.gov/pore/">Point Reyes National Seashore</a> for my break yesterday, the Saturday right before the autumn quarter begins.  For some reason I wanted to see the Pacific ocean; I occasionally feel like seeing some spacious sceneries for a change.  Point Reyes National Seashore is one of the park preserves that are not so far from Stanford University.</p>
<p>Unfortunately the weather wasn&#8217;t good; it was cloudy and foggy.  But still I enjoyed taking a walk around Point Reyes Station and the Lighthouse.  Here are several pictures:</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0387.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0387-300x225.jpg" alt="" title="Bookstore" width="300" height="225" class="alignnone size-medium wp-image-391" /></a><br />
There are several shops in Point Reyes Station.  A store clerk in the bookstore in the middle of this picture was kind enough to give me a free map for the seashore and tell me the way to my destination, the Lighthouse.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0389.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0389-300x225.jpg" alt="" title="Point Reyes Beach" width="300" height="225" class="alignnone size-medium wp-image-392" /></a><br />
This is Point Reyes Beach that goes along with the seashore.  I wish it had been sunny.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0390.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0390-300x225.jpg" alt="" title="Deer" width="300" height="225" class="alignnone size-medium wp-image-393" /></a><br />
You can come across wild animals like this deerlet.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0391.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0391-300x225.jpg" alt="" title="Bent trees" width="300" height="225" class="alignnone size-medium wp-image-394" /></a><br />
These are trees which I think were probably bent due to the wind from the ocean.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0399.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0399-300x225.jpg" alt="" title="The Lighthouse surrounded by a fog" width="300" height="225" class="alignnone size-medium wp-image-395" /></a><br />
The Lighthouse was encompassed with a fog.  If it is sunny, one should be able to see the roundness of the earth with the sea horizon.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0407.jpg"><img src="http://junaraki.net/blog/en/wp-content/uploads/2010/09/cimg0407-300x225.jpg" alt="" title="Water birds" width="300" height="225" class="alignnone size-medium wp-image-396" /></a><br />
I saw some water birds pursuing fish in a marshland on my way back home from the Lighthouse.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/09/19/389.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>English tokenizer</title>
		<link>http://junaraki.net/blog/en/2010/07/17/353.html</link>
		<comments>http://junaraki.net/blog/en/2010/07/17/353.html#comments</comments>
		<pubDate>Sun, 18 Jul 2010 06:32:44 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=353</guid>
		<description><![CDATA[When I build statistical language models (e.g., bigrams and trigrams) trained on a particular corpus or some set of documents, firstly I feel like taking a look at some statistical properties of the set, such as the total number of tokens, the average number of tokens per sentence or per utterance, and so on. Any [...]]]></description>
			<content:encoded><![CDATA[<p>When I build statistical language models (e.g., bigrams and trigrams) trained on a particular corpus or some set of documents, firstly I feel like taking a look at some statistical properties of the set, such as the total number of tokens, the average number of tokens per sentence or per utterance, and so on.  Any set of documents, even one consisting of a tremendous number of newspaper articles, is biased in some manner from a statistical perspective, mainly because people collect the data in a particular domain or domains.</p>
<p>Suppose that I need a list of unique words from English sentences described in a text file sentences.txt.  Then my initial step is often to use a crude shell command like this:</p>
<pre class="brush: python; title: ; notranslate">
$ cat sentences.txt | tr ' ' '\n' | sed '/^$/ d' | sort | uniq &gt; unique_words.txt
</pre>
<p>The list I obtain with this command is neither tokenized nor lemmatized, but it could be sufficient for a quick analysis where I try to get a handle on approximately how many unique words occur in the target document.</p>
<p>If I need a more complicated analysis like extracting a list of unique words with their frequencies, the next step is likely to involve tokenization.  A range of tokenization algorithms have so far been proposed according to respective natural languages.  As for English, it seems that the simplest way is to build a tokenizer with regular expressions, as mentioned in Jurafsky and Martin 2000.  For future reference, I will attach my Java code for English tokenization to this post.</p>
<pre class="brush: java; title: ; notranslate">
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

/**
 * Tokenizes strings described in English.
 *
 * @author Jun Araki
 */
public class EnglishTokenizer {
    /** A string to be tokenized. */
    private String str;

    /** Tokens. */
    private ArrayList&lt;String&gt; tokenList;

    /** A regular expression for letters and numbers. */
    private static final String regexLetterNumber = &quot;[a-zA-Z0-9]&quot;;

    /** A regular expression for non-letters and non-numbers. */
    private static final String regexNotLetterNumber = &quot;[^a-zA-Z0-9]&quot;;

    /** A regular expression for separators. */
    private static final String regexSeparator = &quot;[\\?!()\&quot;;/\\|`]&quot;;

    /** A regular expression for separators. */
    private static final String regexClitics =
        &quot;'|:|-|'S|'D|'M|'LL|'RE|'VE|N'T|'s|'d|'m|'ll|'re|'ve|n't&quot;;

    /** Abbreviations. */
    private static final List&lt;String&gt; abbrList =
        Arrays.asList(&quot;Co.&quot;, &quot;Corp.&quot;, &quot;vs.&quot;, &quot;e.g.&quot;, &quot;etc.&quot;, &quot;ex.&quot;, &quot;cf.&quot;,
            &quot;eg.&quot;, &quot;Jan.&quot;, &quot;Feb.&quot;, &quot;Mar.&quot;, &quot;Apr.&quot;, &quot;Jun.&quot;, &quot;Jul.&quot;, &quot;Aug.&quot;,
            &quot;Sept.&quot;, &quot;Oct.&quot;, &quot;Nov.&quot;, &quot;Dec.&quot;, &quot;jan.&quot;, &quot;feb.&quot;, &quot;mar.&quot;,
            &quot;apr.&quot;, &quot;jun.&quot;, &quot;jul.&quot;, &quot;aug.&quot;, &quot;sept.&quot;, &quot;oct.&quot;, &quot;nov.&quot;,
            &quot;dec.&quot;, &quot;ed.&quot;, &quot;eds.&quot;, &quot;repr.&quot;, &quot;trans.&quot;, &quot;vol.&quot;, &quot;vols.&quot;,
            &quot;rev.&quot;, &quot;est.&quot;, &quot;b.&quot;, &quot;m.&quot;, &quot;bur.&quot;, &quot;d.&quot;, &quot;r.&quot;, &quot;M.&quot;, &quot;Dept.&quot;,
            &quot;MM.&quot;, &quot;U.&quot;, &quot;Mr.&quot;, &quot;Jr.&quot;, &quot;Ms.&quot;, &quot;Mme.&quot;, &quot;Mrs.&quot;, &quot;Dr.&quot;,
            &quot;Ph.D.&quot;);

    /**
     * Constructs a string to be tokenized and an empty list for tokens.
     *
     * @param  str  a string to be tokenized
     */
    public EnglishTokenizer(String str) {
        this.str = str;
        tokenList = new ArrayList&lt;String&gt;();
    }

    /**
     * Tokenizes a string using the algorithms by Grefenstette (1999) and
     * Palmer (2000).
     */
    public void tokenize() {
        // Changes tabs into spaces.
        str = str.replaceAll(&quot;\\t&quot;, &quot; &quot;);

        // Puts blanks around unambiguous separators.
        str = str.replaceAll(&quot;(&quot; + regexSeparator + &quot;)&quot;, &quot; $1 &quot;);

        // Puts blanks around commas that are not inside numbers.
        str = str.replaceAll(&quot;([^0-9]),&quot;, &quot;$1 , &quot;);
        str = str.replaceAll(&quot;,([^0-9])&quot;, &quot; , $1&quot;);

        // Distinguishes single quotes from apstrophes by segmenting off
        // single quotes not preceded by letters.
        str = str.replaceAll(&quot;^(')&quot;, &quot;$1 &quot;);
        str = str.replaceAll(&quot;(&quot; + regexNotLetterNumber + &quot;)'&quot;, &quot;$1 '&quot;);

        // Segments off unambiguous word-final clitics and punctuations.
        str = str.replaceAll(&quot;(&quot; + regexClitics + &quot;)$&quot;, &quot; $1&quot;);
        str = str.replaceAll(
                &quot;(&quot; + regexClitics + &quot;)(&quot; + regexNotLetterNumber + &quot;)&quot;,
                &quot; $1 $2&quot;);

        // Deals with periods.
        String[] words = str.trim().split(&quot;\\s+&quot;);
        Pattern p1 = Pattern.compile(&quot;.*&quot; + regexLetterNumber + &quot;\\.&quot;);
        Pattern p2 = Pattern.compile(
            &quot;^([A-Za-z]\\.([A-Za-z]\\.)+|[A-Z][bcdfghj-nptvxz]+\\.)$&quot;);
        for (String word : words) {
            Matcher m1 = p1.matcher(word);
            Matcher m2 = p2.matcher(word);
            if (m1.matches() &amp;&amp; !abbrList.contains(word) &amp;&amp; !m2.matches()) {
                // Segments off the period.
                tokenList.add(word.substring(0, word.length() - 1));
                tokenList.add(word.substring(word.length() - 1));
            } else {
                tokenList.add(word);
            }
        }
    }

    /**
     * Returns tokenized strings.
     *
     * @return  a list of tokenized strings
     */
    public String[] getTokens() {
        String[] tokens = new String[tokenList.size()];
        tokenList.toArray(tokens);
        return tokens;
    }
}
</pre>
<p>References:</p>
<p>Daniel Jurafsky and James H. Martin. 2000. Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics and Speech Recognition (Prentice Hall Series in Artificial Intelligence). Prentice Hall.</p>
<p>Gregory Grefenstette. 1999. Tokenization. In van Halteren, H. (Ed.), Syntactic Wordclass Tagging. Kluwer.</p>
<p>David D. Palmer. 2000. Tokenisation and sentence segmentation. In Dale, R., Moisl, H., and Somers, H. L. (Eds.), Handbook of Natural Language Processing. Marcel Dekker.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/07/17/353.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Japan Day</title>
		<link>http://junaraki.net/blog/en/2010/05/15/318.html</link>
		<comments>http://junaraki.net/blog/en/2010/05/15/318.html#comments</comments>
		<pubDate>Sat, 15 May 2010 23:03:44 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Event]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=318</guid>
		<description><![CDATA[Japan Day is an event held at the Bechtel International Center at Stanford University on Saturday, May 8 by Stanford Japanese Association (SJA) and Stanford University Nikkei (SUN). Since I was interested in what was going on in the event but had little time to enjoy it on that day, I just dropped by after [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.stanford.edu/~thoshi/japanday">Japan Day</a> is an event held at the <a href="http://icenter.stanford.edu/">Bechtel International Center</a> at Stanford University on Saturday, May 8 by Stanford Japanese Association (SJA) and Stanford University Nikkei (SUN).  Since I was interested in what was going on in the event but had little time to enjoy it on that day, I just dropped by after lunch, and walked around to look at some demonstrations.</p>
<p>There were several corners for presenting Japanese culture.  Out of them, the tea ceremony seemed to be the most popular.  Two Japanese women wearing traditional garment, <em><a href="http://en.wikipedia.org/wiki/Kimono">kimonos</a></em>, demonstrated how to make and have Japanese tea in a formal way.  In addition, some Japanese people tried to teach how to write Japanese calligraphy, <em><a href="http://en.wikipedia.org/wiki/Japanese_calligraphy">shodo</a></em>, and how to do Japanese paper folding, <em><a href="http://en.wikipedia.org/wiki/Origami">origami</a></em>.  Just being there for about ten minutes, I was struck by a sense of nostalgia.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/05/cimg0369.jpg"><img class="alignnone size-medium wp-image-320" title="Tea ceremony" src="http://junaraki.net/blog/en/wp-content/uploads/2010/05/cimg0369-300x225.jpg" alt="" width="300" height="225" /></a><br />
Two Japanese women demonstrating how to make and have Japanese tea.</p>
<p><a href="http://junaraki.net/blog/en/wp-content/uploads/2010/05/cimg0371.jpg"><img class="alignnone size-medium wp-image-321" title="Some ornaments for the Boys' Festival" src="http://junaraki.net/blog/en/wp-content/uploads/2010/05/cimg0371-300x225.jpg" alt="" width="300" height="225" /></a><br />
Some ornaments for the Boy&#8217;s Festival in Japan.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/05/15/318.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running in the U.S.</title>
		<link>http://junaraki.net/blog/en/2010/03/23/281.html</link>
		<comments>http://junaraki.net/blog/en/2010/03/23/281.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 07:02:19 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=281</guid>
		<description><![CDATA[We finished final exams for the winter quarter last week, and now we have a one-week spring break. Yesterday I started running again. I ran around campus just for a while, and felt great after running. A few months ago, thankfully my father sent me my sportswear and armband for an iPod shuffle that I [...]]]></description>
			<content:encoded><![CDATA[<p>We finished final exams for the winter quarter last week, and now we have a one-week spring break.  Yesterday I started running again.  I ran around campus just for a while, and felt great after running.  A few months ago, thankfully my father sent me my sportswear and armband for an iPod shuffle that I had been using when running in Tokyo. So I could enjoy running here at Stanford just as I had been doing there.</p>
<p>As I wrote in a <a href="http://junaraki.net/blog/en/2009/09/03/174.html">previous post</a>, some people around Stanford University are very active.  I always see several people enjoying their exercise on campus.  Some of them are such avid runners that they push a baby carriage with their baby or babies while running, though I think this is a little dangerous.</p>
<p>Once the spring quarter begins, probably I will be very busy again.  But I&#8217;d like to enjoy myself doing exercise as much as possible.   Incidentally, I am somewhat interested in the general relationships between physical activities and our brains.  A suggestive (but informal) article on this topic is from PhDs.org: <a href="http://blog.phds.org/2010/1/20/pe-for-grad-students">PE for grad students</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/03/23/281.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading a text file with Java</title>
		<link>http://junaraki.net/blog/en/2010/02/20/270.html</link>
		<comments>http://junaraki.net/blog/en/2010/02/20/270.html#comments</comments>
		<pubDate>Sun, 21 Feb 2010 04:49:53 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=270</guid>
		<description><![CDATA[Recently I regularly use Java in some classes and my research. In particular, I often implement a similar code to read a text file for the purpose of some text processing. So I will attach the trivial code to this post for future reference. I confirmed that it works with Java 1.6.0_16. Incidentally I have [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I regularly use Java in some classes and my research.  In particular, I often implement a similar code to read a text file for the purpose of some text processing.  So I will attach the trivial code to this post for future reference.  I confirmed that it works with Java 1.6.0_16.</p>
<pre class="brush: java; title: ; notranslate">
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;

class SomeClass {
    public static void readFromFile(String filename) {
        BufferedReader fin = null;

        try {
            fin = new BufferedReader(new FileReader(filename));
            String line = null;
            while ((line = fin.readLine()) != null) {
                // Do something.
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (fin != null) fin.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String args[]) {
        readFromFile(&quot;sample.txt&quot;);
    }
}
</pre>
<p>Incidentally I have used BufferedReader rather than BufferedInputStream simply because BufferedReader is more suitable to the text processing that I need to do right now.</p>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/02/20/270.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSV to HTML converter</title>
		<link>http://junaraki.net/blog/en/2010/02/13/257.html</link>
		<comments>http://junaraki.net/blog/en/2010/02/13/257.html#comments</comments>
		<pubDate>Sun, 14 Feb 2010 01:30:13 +0000</pubDate>
		<dc:creator>araki</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://junaraki.net/blog/en/?p=257</guid>
		<description><![CDATA[I have spent some time implementing a small script with Python 2.6.2 to help my trivial work: concerting CSV to HTML (more precisely a CSV file to an HTML table). The CSV format for its input depends on what the csv module in Python specifies. The code is pretty straightforward: An example of usage is [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent some time implementing a small script with Python 2.6.2 to help my trivial work: concerting CSV to HTML (more precisely a CSV file to an HTML table).  The CSV format for its input depends on what the csv module in Python specifies.  The code is pretty straightforward:</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/python

# csv2html.py
# CSV to HTML Converter

import csv
import sys

table_indent_num = 2
tr_indent_num = 4
td_indent_num = 6
white_space = &quot; &quot;

def main():
    csv_reader = csv.reader(open(sys.argv[1]))
    table_indent = white_space * table_indent_num
    tr_indent = white_space * tr_indent_num
    td_indent = white_space * td_indent_num

    print table_indent + &quot;&lt;table&gt;&quot;
    for i, row in enumerate(csv_reader):
        print tr_indent + &quot;&lt;tr&gt;&quot;

        # Uncomment the following two lines if you don't
        # want a column for indexes
        if i == 0: print td_indent + &quot;&lt;th&gt;#&lt;/th&gt;&quot;
        else: print td_indent + &quot;&lt;td&gt;&quot; + str(i) + &quot;&lt;/td&gt;&quot;

        # Assume that the first line is a header
        for column in row:
            if i == 0: print td_indent + &quot;&lt;th&gt;&quot; + column + &quot;&lt;/th&gt;&quot;
            else: print td_indent + &quot;&lt;td&gt;&quot; + column + &quot;&lt;/td&gt;&quot;

        print tr_indent + &quot;&lt;/tr&gt;&quot;

    print table_indent + &quot;&lt;/table&gt;&quot;

if __name__ == &quot;__main__&quot;:
    argn = len(sys.argv)
    if argn != 2:
        print &quot;Usage: python csv2html.py &lt;CSV file&gt;&quot;
        exit(1)

    main()
</pre>
<p>An example of usage is as follows:</p>
<pre class="brush: python; title: ; notranslate">
$ more sample.csv
title1,title2,title3
&quot;test11&quot;,test12,test13
test21,&quot;test,22&quot;,test23
$ python csv2html.py sample.csv &gt; sample.html
$ more sample.html
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;#&lt;/th&gt;
      &lt;th&gt;title1&lt;/th&gt;
      &lt;th&gt;title2&lt;/th&gt;
      &lt;th&gt;title3&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;test11&lt;/td&gt;
      &lt;td&gt;test12&lt;/td&gt;
      &lt;td&gt;test13&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;test21&lt;/td&gt;
      &lt;td&gt;test,22&lt;/td&gt;
      &lt;td&gt;test23&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://junaraki.net/blog/en/2010/02/13/257.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

