<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>unihancantonese.txt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 require 'osx/cocoa'
-
+require 'rubygems'
+require 'jcode'
+$KCODE='u'
+require 'activesupport'
 class Controller &lt; OSX::NSObject
   attr_writer :results_table_view, :search_field
   
@@ -7,16 +10,8 @@ class Controller &lt; OSX::NSObject
 	@results = []
 	@results_table_view.dataSource = self
 	@path = OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation
-=begin	
-	@dict ||= File.readlines(@path+&quot;/cedict_ts.u8&quot;)[1..-1].collect do |x|
-	  r= Result.new
-	  data= /(\S+) (\S+) \[(.+)\] (.+)/.match(x)
-	  r.chinese =  data[1]
-	  r.english =  data[4]
-	  r.pinyin = data[3]
-	  r.simplified = data[2]
-	end
-=end
+	#  grep kCantonese Unihan.txt &gt; unihancantonese.txt 
+	@cantonese = File.readlines @path+&quot;/unihancantonese.txt&quot;
   end
 
   def dict
@@ -35,7 +30,6 @@ class Controller &lt; OSX::NSObject
   
   def search(sender)
 	q = @search_field.stringValue
-	#sender.window.Title=title if frame == sender.mainFrame
 	puts &quot;query: #{q}&quot;
 	matches = q.blank? ? [] : dict.select{|x| x.match /#{q}/}
 	@results = []
@@ -51,6 +45,9 @@ class Controller &lt; OSX::NSObject
 	  r.english =  data[4]
 	  r.pinyin = data[3]
 	  r.simplified = data[2]
+	  hex = &quot;U+&quot;+(&quot;%x&quot; % (data[1].unpack('U*').to_s.to_i)).upcase
+	  jyutpin = @cantonese.detect{|x| x.match /#{Regexp.escape(hex)}/}
+	  r.jyutpin = jyutpin.strip.split[2..-1].to_s if jyutpin
 	  @results &lt;&lt; r
 	end
 	@results_table_view.reloadData
@@ -75,4 +72,4 @@ class String
     match(/\D+/)
   end
   
-end
\ No newline at end of file
+end</diff>
      <filename>Controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,7 @@
 		4DDCA70A0ACC9A6100E082CE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
 		4DDCA70C0ACC9A6100E082CE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
 		4DDCA70D0ACC9A6100E082CE /* RubyCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8F5E24E03AEB6EC03A81C6F /* RubyCocoa.framework */; };
+		5F021B910EFE5C28003AB07C /* unihancantonese.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5F021B900EFE5C28003AB07C /* unihancantonese.txt */; };
 		5F7976E40EE36E4C0069256D /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5F7976E20EE36E4C0069256D /* MainMenu.xib */; };
 		5FA8AC750EE31C4300F4544A /* Controller.rb in Resources */ = {isa = PBXBuildFile; fileRef = 5FA8AC740EE31C4300F4544A /* Controller.rb */; };
 		5FA8AC790EE31F4D00F4544A /* cedict_ts.u8 in Resources */ = {isa = PBXBuildFile; fileRef = 5FA8AC780EE31F4D00F4544A /* cedict_ts.u8 */; };
@@ -25,6 +26,7 @@
 		29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = &quot;&lt;absolute&gt;&quot;; };
 		4DDCA7110ACC9A6100E082CE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = &quot;&lt;group&gt;&quot;; };
 		4DDCA7120ACC9A6100E082CE /* crdict.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = crdict.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		5F021B900EFE5C28003AB07C /* unihancantonese.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unihancantonese.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
 		5F7976E30EE36E4C0069256D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = &quot;&lt;group&gt;&quot;; };
 		5FA8AC740EE31C4300F4544A /* Controller.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = Controller.rb; sourceTree = &quot;&lt;group&gt;&quot;; };
 		5FA8AC780EE31F4D00F4544A /* cedict_ts.u8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cedict_ts.u8; sourceTree = &quot;&lt;group&gt;&quot;; };
@@ -104,6 +106,7 @@
 		29B97317FDCFA39411CA2CEA /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				5F021B900EFE5C28003AB07C /* unihancantonese.txt */,
 				089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
 				5FA8AC740EE31C4300F4544A /* Controller.rb */,
 				5FA8AC780EE31F4D00F4544A /* cedict_ts.u8 */,
@@ -179,6 +182,7 @@
 				5FA8AC750EE31C4300F4544A /* Controller.rb in Resources */,
 				5FA8AC790EE31F4D00F4544A /* cedict_ts.u8 in Resources */,
 				5F7976E40EE36E4C0069256D /* MainMenu.xib in Resources */,
+				5F021B910EFE5C28003AB07C /* unihancantonese.txt in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};</diff>
      <filename>crdict.xcodeproj/project.pbxproj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>285ea6ef72ff74ff236b236f6aa36b4e832958f6</id>
    </parent>
  </parents>
  <author>
    <name>Jason</name>
    <email>jason@rubynow.com</email>
  </author>
  <url>http://github.com/jtoy/crdict/commit/89b2762bc6da8430a6c35b4986a2a54072f33937</url>
  <id>89b2762bc6da8430a6c35b4986a2a54072f33937</id>
  <committed-date>2008-12-21T03:59:42-08:00</committed-date>
  <authored-date>2008-12-21T03:59:42-08:00</authored-date>
  <message>code cleanups</message>
  <tree>480dece06a5817d9ccb7fbce773d1415731d34fc</tree>
  <committer>
    <name>Jason</name>
    <email>jason@rubynow.com</email>
  </committer>
</commit>
