Hiroyuki Komatsu
komat****@users*****
2004年 12月 15日 (水) 23:12:58 JST
Index: prime/lib/prime.rb diff -u prime/lib/prime.rb:1.14 prime/lib/prime.rb:1.15 --- prime/lib/prime.rb:1.14 Thu Dec 9 21:24:16 2004 +++ prime/lib/prime.rb Wed Dec 15 23:12:58 2004 @@ -1,5 +1,5 @@ # prime/prime.rb -# $Id: prime.rb,v 1.14 2004/12/09 12:24:16 komatsu Exp $ +# $Id: prime.rb,v 1.15 2004/12/15 14:12:58 komatsu Exp $ # # Copyright (C) 2002, 2003, 2004 Hiroyuki Komatsu <komat****@taiya*****> # All rights reserved. @@ -201,11 +201,11 @@ def lookup_compact (string) words_compact = search_compact(string) - words = PrimeWordList::merge_with_label(@context, words_compact) + words = PrimeWordList::attach_prefix(@context, words_compact) return words end def lookup_compact_all (string) - words_compact = search_compact(string) + words_compact = lookup_compact(string) words_overall = search_overall(string) words_japanese = search_japanese(string) @@ -538,6 +538,15 @@ return merged end + ## This attaches a prefix characters depend on the context, + ## and returns the given words. + def PrimeWordList::attach_prefix (context, words) + words.each { | word | + word.prefix = Prime::get_prefix(context, word.literal) + } + return words + end + def to_text texts = self.map {|word| word.to_text