[Prime-cvs] CVS update: prime/lib

Back to archive index

Hiroyuki Komatsu komat****@users*****
2005年 3月 8日 (火) 20:24:57 JST


Index: prime/lib/composer.rb
diff -u prime/lib/composer.rb:1.4 prime/lib/composer.rb:1.5
--- prime/lib/composer.rb:1.4	Mon Mar  7 21:19:15 2005
+++ prime/lib/composer.rb	Tue Mar  8 20:24:57 2005
@@ -1,5 +1,5 @@
 # composer.rb: Module of composition for PrimeSession
-# $Id: composer.rb,v 1.4 2005/03/07 12:19:15 komatsu Exp $
+# $Id: composer.rb,v 1.5 2005/03/08 11:24:57 komatsu Exp $
 #
 # Copyright (C) 2005 Hiroyuki Komatsu <komat****@taiya*****>
 #     All rights reserved.
@@ -40,12 +40,10 @@
       return true
     end
 
-#    ## If the cursor does not locate the end of the preedition, 
-#    ## the preedition will not be modified.
-#    if preedition[1] != '' or preedition[2] != '' then
-#      return preedition
-#    end
-#    conversion = preedition[0]
+    rawinput = edit_get_raw_input()[0]
+    if rawinput.nil? then
+      return true
+    end
 
     ## edit_get_expansion_internal ignores the typing_mode.
     ## If the typing_mode is :raw, edit_get_expansion just returns rawinput.
@@ -58,12 +56,13 @@
       return true
     end
 
-    rawinput = edit_get_raw_input()[0]
-    if rawinput.nil? then
-      return true
-    end
-
+    max_score = words[0].score
+    threshold = 4000
     words.each { | word |
+      if max_score - word.score > threshold then
+        break
+      end
+
       if word.pron.index(rawinput) != 0 then
         return true
       end
Index: prime/lib/prime2.rb
diff -u prime/lib/prime2.rb:1.2 prime/lib/prime2.rb:1.3
--- prime/lib/prime2.rb:1.2	Mon Mar  7 16:51:32 2005
+++ prime/lib/prime2.rb	Tue Mar  8 20:24:57 2005
@@ -1,5 +1,5 @@
 # prime2.rb: Module for PRIME2 protocol.
-# $Id: prime2.rb,v 1.2 2005/03/07 07:51:32 komatsu Exp $
+# $Id: prime2.rb,v 1.3 2005/03/08 11:24:57 komatsu Exp $
 #
 # Copyright (C) 2004 Hiroyuki Komatsu <komat****@taiya*****>
 #     All rights reserved.
@@ -148,6 +148,14 @@
     @score    = score
   end
 
+  def <=> ( other )
+    case other
+    when PrimeConversion then
+      return @score <=> other.score
+    end
+    return nil
+  end
+
   def dup ()
     return PrimeConversion.new(@segments.dup, @score, @position)
   end
Index: prime/lib/session-japanese.rb
diff -u prime/lib/session-japanese.rb:1.3 prime/lib/session-japanese.rb:1.4
--- prime/lib/session-japanese.rb:1.3	Mon Mar  7 18:26:57 2005
+++ prime/lib/session-japanese.rb	Tue Mar  8 20:24:57 2005
@@ -1,5 +1,5 @@
 # session-japanese.rb: Session library for Japanese.
-# $Id: session-japanese.rb,v 1.3 2005/03/07 09:26:57 komatsu Exp $
+# $Id: session-japanese.rb,v 1.4 2005/03/08 11:24:57 komatsu Exp $
 #
 # Copyright (C) 2005 Hiroyuki Komatsu <komat****@taiya*****>
 #     All rights reserved.
@@ -320,7 +320,8 @@
     ## If the result of convert_japanese_uniclause exists and the score of it
     ## is greater than the result of convert_prefix, the return conversion
     ## becomes the convert_japanese_uniclause's one.
-    conversion_japanese = convert_japanese_uniclause().first()
+    conversion_japanese = convert_japanese_uniclause().max()
+
     if conversion_japanese.nil?() then
       conversion = conversion_prefix
     elsif conversion_japanese.score < conversion_prefix.score then


Prime-cvs メーリングリストの案内
Back to archive index