Hiroyuki Komatsu
komat****@users*****
2005年 3月 2日 (水) 04:58:20 JST
Index: prime/lib/prime-mixed.rb diff -u prime/lib/prime-mixed.rb:1.2.4.3 prime/lib/prime-mixed.rb:1.2.4.4 --- prime/lib/prime-mixed.rb:1.2.4.3 Tue Feb 15 20:17:35 2005 +++ prime/lib/prime-mixed.rb Wed Mar 2 04:58:20 2005 @@ -1,5 +1,5 @@ # prime/prime-mixed.rb -# $Id: prime-mixed.rb,v 1.2.4.3 2005/02/15 11:17:35 komatsu Exp $ +# $Id: prime-mixed.rb,v 1.2.4.4 2005/03/01 19:58:20 komatsu Exp $ # # Copyright (C) 2004 Hiroyuki Komatsu <komat****@taiya*****> # All rights reserved. @@ -78,79 +78,93 @@ return regexp_literal.gsub(/(\.\+)+/, ".+") end - def lookup_mixed_combine_regexp2 (data_list) - regexp_pron = "" - regexp_literal = "" +# def lookup_mixed_combine_regexp2 (data_list) +# regexp_pron = "" +# regexp_literal = "" - data_list.each {|(prons, literals)| - if prons.length == 1 then - regexp_pron += prons[0] - else - regexp_pron += "(" + prons.uniq.join("|") + ")" - end - if literals.length == 1 then - regexp_literal += literals[0] - else - regexp_literal += "(" + literals.uniq.join("|") + ")" - end - } -# p regexp_pron -# p regexp_literal - end +# data_list.each {|(prons, literals)| +# if prons.length == 1 then +# regexp_pron += prons[0] +# else +# regexp_pron += "(" + prons.uniq.join("|") + ")" +# end +# if literals.length == 1 then +# regexp_literal += literals[0] +# else +# regexp_literal += "(" + literals.uniq.join("|") + ")" +# end +# } +# # p regexp_pron +# # p regexp_literal +# end def lookup_mixed_concat_data_list (data_list) - lookup_mixed_concat_data_list_2(data_list) + lookup_mixed_concat_data_list_pron(data_list) end - def lookup_mixed_concat_data_list_2 (data_list) - result_words = PrimeWordList.new() - (prons, literals) = data_list[0] +# def lookup_mixed_concat_data_list_2 (data_list) +# result_words = PrimeWordList.new() +# (prons, literals) = data_list[0] - literals.each {|literal| - query = PrimeQuery.new([literal], nil, :literal_prefix) - words = search(query) - result_words += taiyaki_2(words, literal, data_list[1..-1]) - } - return result_words - end +# literals.each {|literal| +# query = PrimeQuery.new([literal], nil, :literal_prefix) +# words = search(query) +# result_words += +# lookup_mixed_concat_data_list_2_internal(words, +# literal, +# data_list[1..-1]) +# } +# return result_words +# end - def taiyaki_2 (words, prefix, data_list) - if data_list.empty? then - return words - end +# def lookup_mixed_concat_data_list_2_internal (words, prefix, data_list) +# p words - result_words = PrimeWordList.new() - (prons, literals) = data_list[0] +# result_words = PrimeWordList.new() - literals.each {|literal| - next_prefix = prefix + literal - scoped_words = PrimeWordList.new() - words.each {|word| - if word.literal.index(next_prefix) == 0 then - scoped_words.push(word) - end - } - result_words += taiyaki_2(scoped_words, next_prefix, data_list[1..-1]) - } - return result_words - end +# if data_list.empty? then +# scoped_words = PrimeWordList.new() +# words.each {|word| +# if word.literal == prefix then +# result_words.push(word) +# end +# } +# return result_words +# end +# (prons, literals) = data_list[0] +# literals.each {|literal| +# next_prefix = prefix + literal +# scoped_words = PrimeWordList.new() +# words.each {|word| +# if word.literal.index(next_prefix) == 0 then +# scoped_words.push(word) +# end +# } +# result_words += +# lookup_mixed_concat_data_list_2_internal(scoped_words, +# next_prefix, +# data_list[1..-1]) +# } +# return result_words +# end - def lookup_mixed_concat_data_list_literal (data_list) - data_cands = [""] - data_list.each {|(prons, literals)| - new_data_cands = [] - literals.each {|literal| - data_cands.each {|data_cand| - new_data_cands.push( data_cand + literal ) - } - } - data_cands = new_data_cands - } - query = PrimeQuery.new(data_cands, nil, :literal_exact) - words = search(query) - return words - end + +# def lookup_mixed_concat_data_list_literal (data_list) +# data_cands = [""] +# data_list.each {|(prons, literals)| +# new_data_cands = [] +# literals.each {|literal| +# data_cands.each {|data_cand| +# new_data_cands.push( data_cand + literal ) +# } +# } +# data_cands = new_data_cands +# } +# query = PrimeQuery.new(data_cands, nil, :literal_exact) +# words = search(query) +# return words +# end def lookup_mixed_concat_data_list_pron (data_list) data_cands = [""] @@ -163,15 +177,15 @@ } data_cands = new_data_cands } -# query = PrimeQuery.new(data_cands, nil, :exact) - query = PrimeQuery.new(data_cands, nil, :prefix) + query = PrimeQuery.new(data_cands, nil, :exact) +# query = PrimeQuery.new(data_cands, nil, :prefix) temp_words = search(query) -# literal_regexp = "^" + lookup_mixed_combine_regexp(data_list) + "$" +# literal_regexp = "^" + lookup_mixed_combine_regexp(data_list) + "$" literal_regexp = "^" + lookup_mixed_combine_regexp(data_list) words = PrimeWordList.new() temp_words.each {|word| - if word.literal =~ literal_regexp then + if word.literal =~ /#{literal_regexp}/ then words.push(word) end } Index: prime/lib/session-japanese.rb diff -u prime/lib/session-japanese.rb:1.1.2.2 prime/lib/session-japanese.rb:1.1.2.3 --- prime/lib/session-japanese.rb:1.1.2.2 Wed Mar 2 02:34:55 2005 +++ prime/lib/session-japanese.rb Wed Mar 2 04:58:20 2005 @@ -1,5 +1,5 @@ # session-japanese.rb: Session library for Japanese. -# $Id: session-japanese.rb,v 1.1.2.2 2005/03/01 17:34:55 komatsu Exp $ +# $Id: session-japanese.rb,v 1.1.2.3 2005/03/01 19:58:20 komatsu Exp $ # # Copyright (C) 2005 Hiroyuki Komatsu <komat****@taiya*****> # All rights reserved. @@ -75,6 +75,9 @@ composer.set_table_entry(char, char) composer.set_reverse_table_entry(char, char) end +# if PRIME_ENV['style_mask_pending_chars'] then + composer.mask = true +# end end return composer