<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,3 +2,4 @@
 
 * Created homepage on Rubyforge.
 * Gem can be installed directly from Rubyforge now.
+* Added rdoc for native extensions.</diff>
      <filename>History.txt</filename>
    </modified>
    <modified>
      <diff>@@ -26,18 +26,48 @@ extern &quot;C&quot; {
      *********************/
     static VALUE mDictionary;
 
+    /*
+     * Load a character dictionary.
+     *
+     * call-seq:
+     *   load_chars(path)    -&gt; status
+     *
+     * Return +true+ if loaded successfully, +false+ otherwise.
+     */ 
     static VALUE dic_load_chars(VALUE mod, VALUE path)
     {
         if (rmmseg::dict::load_chars(RSTRING(path)-&gt;ptr))
             return Qtrue;
         return Qfalse;
     }
+
+    /*
+     * Load a word dictionary.
+     *
+     * call-seq:
+     *   load_words(path)    -&gt; status
+     *
+     * Return +true+ if loaded successfully, +false+ otherwise.
+     */ 
     static VALUE dic_load_words(VALUE mod, VALUE path)
     {
         if (rmmseg::dict::load_words(RSTRING(path)-&gt;ptr))
             return Qtrue;
         return Qfalse;
     }
+
+    /*
+     * Add a word to the in-memory dictionary.
+     *
+     * call-seq:
+     *   add(word, length, freq)
+     *
+     * - +word+ is a String.
+     * - +length+ is number of characters (not number of bytes) of the
+     *   word to be added.
+     * - +freq+ is the frequency of the word. This is only used when
+     *   it is a one-character word.
+     */ 
     static VALUE dic_add(VALUE mod, VALUE word, VALUE len, VALUE freq)
     {
         const char *str = RSTRING(word)-&gt;ptr;
@@ -46,6 +76,16 @@ extern &quot;C&quot; {
         rmmseg::dict::add(w);
         return Qnil;
     }
+
+    /*
+     * Check whether one word is included in the dictionary.
+     *
+     * call-seq:
+     *   has_word?(word)    -&gt; result
+     *
+     * Return +true+ if the word is included in the dictionary,
+     * +false+ otherwise.
+     */ 
     static VALUE dic_has_word(VALUE mod, VALUE word)
     {
         const char *str = RSTRING(word)-&gt;ptr;
@@ -76,16 +116,39 @@ extern &quot;C&quot; {
         free(t);
     }
 
+    /*
+     * Get the text held by this token.
+     *
+     * call-seq:
+     *   text()    -&gt; text
+     *   
+     */
     static VALUE tk_text(VALUE self)
     {
         Token *tk = (Token *)DATA_PTR(self);
         return tk-&gt;text;
     }
+
+    /*
+     * Get the start position of this token.
+     *
+     * call-seq:
+     *   start()    -&gt; start_pos
+     *
+     */
     static VALUE tk_start(VALUE self)
     {
         Token *tk = (Token *)DATA_PTR(self);
         return tk-&gt;start;
     }
+
+    /*
+     * Get the end position of this token.
+     *
+     * call-seq:
+     *   end()    -&gt; end_pos
+     *
+     */
     static VALUE tk_end(VALUE self)
     {
         Token *tk = (Token *)DATA_PTR(self);
@@ -130,6 +193,14 @@ extern &quot;C&quot; {
     }
 
     static VALUE cAlgorithm;
+
+    /*
+     * Create an Algorithm object to do segmenting on +text+.
+     *
+     * call-seq:
+     *   new(text)    -&gt; algorithm
+     *   
+     */ 
     static VALUE algor_create(VALUE klass, VALUE text)
     {
         Algorithm *algor = ALLOC(Algorithm);
@@ -144,6 +215,15 @@ extern &quot;C&quot; {
                                 (RUBY_DATA_FUNC)algor_free,
                                 algor);
     }
+
+    /*
+     * Get next token.
+     *
+     * call-seq:
+     *   next_token()   -&gt; token
+     *
+     * Return +nil+ if no more token available.
+     */ 
     static VALUE algor_next_token(VALUE self)
     {
         Algorithm *algor = (Algorithm *)DATA_PTR(self);
@@ -157,24 +237,25 @@ extern &quot;C&quot; {
 
     void Init_rmmseg()
     {
-        typedef VALUE (*RUBY_METHOD) (...);
         mRMMSeg = rb_define_module(&quot;RMMSeg&quot;);
 
+        /* Manage dictionaries used by rmmseg. */
         mDictionary = rb_define_module_under(mRMMSeg, &quot;Dictionary&quot;);
+        rb_define_singleton_method(mDictionary, &quot;load_chars&quot;, RUBY_METHOD_FUNC(dic_load_chars), 1);
+        rb_define_singleton_method(mDictionary, &quot;load_words&quot;, RUBY_METHOD_FUNC(dic_load_words), 1);
+        rb_define_singleton_method(mDictionary, &quot;add&quot;, RUBY_METHOD_FUNC(dic_add), 3);
+        rb_define_singleton_method(mDictionary, &quot;has_word?&quot;, RUBY_METHOD_FUNC(dic_has_word), 1);
 
-        rb_define_singleton_method(mDictionary, &quot;load_chars&quot;, (RUBY_METHOD)dic_load_chars, 1);
-        rb_define_singleton_method(mDictionary, &quot;load_words&quot;, (RUBY_METHOD)dic_load_words, 1);
-        rb_define_singleton_method(mDictionary, &quot;load_add&quot;, (RUBY_METHOD)dic_add, 3);
-        rb_define_singleton_method(mDictionary, &quot;has_word?&quot;, (RUBY_METHOD)dic_has_word, 1);
-
+        /* A Token hold the text and related position information. */
         cToken = rb_define_class_under(mRMMSeg, &quot;Token&quot;, rb_cObject);
         rb_undef_method(rb_singleton_class(cToken), &quot;new&quot;);
-        rb_define_method(cToken, &quot;text&quot;, (RUBY_METHOD)tk_text, 0);
-        rb_define_method(cToken, &quot;start&quot;, (RUBY_METHOD)tk_start, 0);
-        rb_define_method(cToken, &quot;end&quot;, (RUBY_METHOD)tk_end, 0);
+        rb_define_method(cToken, &quot;text&quot;, RUBY_METHOD_FUNC(tk_text), 0);
+        rb_define_method(cToken, &quot;start&quot;, RUBY_METHOD_FUNC(tk_start), 0);
+        rb_define_method(cToken, &quot;end&quot;, RUBY_METHOD_FUNC(tk_end), 0);
 
+        /* An Algorithm object use the MMSEG algorithm to do segmenting. */
         cAlgorithm = rb_define_class_under(mRMMSeg, &quot;Algorithm&quot;, rb_cObject);
-        rb_define_singleton_method(cAlgorithm, &quot;new&quot;, (RUBY_METHOD)algor_create, 1);
-        rb_define_method(cAlgorithm, &quot;next_token&quot;, (RUBY_METHOD)algor_next_token, 0);
+        rb_define_singleton_method(cAlgorithm, &quot;new&quot;, RUBY_METHOD_FUNC(algor_create), 1);
+        rb_define_method(cAlgorithm, &quot;next_token&quot;, RUBY_METHOD_FUNC(algor_next_token), 0);
     }
 }</diff>
      <filename>ext/rmmseg/rmmseg.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -42,6 +42,9 @@ module RMMSeg
         @dictionaries &lt;&lt; [type, path]
       end
 
+      # Load dictionaries. Call this method after set up the path of the
+      # dictionaries needed to load and before any Algorithm object is
+      # created.
       def load_dictionaries()
         @dictionaries.each do |type, path|
           if type == :chars</diff>
      <filename>lib/rmmseg/dictionary.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,3 @@
-require 'singleton'
 require 'rubygems'
 require 'rmmseg'
 require 'ferret'</diff>
      <filename>lib/rmmseg/ferret.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6b655043a2ef322060185d28afe788d4b9961054</id>
    </parent>
  </parents>
  <author>
    <name>pluskid</name>
    <email>pluskid@gmail.com</email>
  </author>
  <url>http://github.com/pluskid/rmmseg-cpp/commit/34bebd0985ed4dec340388b518e5a1a9771f1c5e</url>
  <id>34bebd0985ed4dec340388b518e5a1a9771f1c5e</id>
  <committed-date>2008-06-07T16:12:01-07:00</committed-date>
  <authored-date>2008-06-07T16:11:25-07:00</authored-date>
  <message>Added rdoc for native extensions.</message>
  <tree>3b48d958fcc07785e34becc82d66a9f86d40e8a9</tree>
  <committer>
    <name>pluskid</name>
    <email>pluskid@gmail.com</email>
  </committer>
</commit>
