From 0e2bcef31cc80fc0e521a3f0a2e430910bb25fe3 Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Fri, 23 Nov 2007 22:20:22 +0000 Subject: shiritori.rb: use normalize-japanese.rb, if present, to allow katakana --- data/rbot/plugins/games/shiritori.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'data') diff --git a/data/rbot/plugins/games/shiritori.rb b/data/rbot/plugins/games/shiritori.rb index 111c914a..71016e54 100644 --- a/data/rbot/plugins/games/shiritori.rb +++ b/data/rbot/plugins/games/shiritori.rb @@ -15,6 +15,10 @@ # playing several games, each per channel. A game can be turn-based, where only new # players can interrupt a turn to join, or a free mode where anyone can speak at any # time. +# +# In Japanese mode, if present, the plugin can use normalize-japanese +# to allow +# katakana words be used like hiragana. # # TODO # * a system to describe settings, so they can be displayed, changed and saved @@ -367,7 +371,13 @@ class ShiritoriPlugin < Plugin :listen => /\A\S+\Z/u, :overlap_lengths => 1..4, :desc => 'Use Japanese words in hiragana; 1-4 kana at the beginning of the next word must overlap with those at the end of the previous word.', - # Optionally use a module to normalize Japanese words, enabling input in multiple writing systems + :normalize => + begin + require 'normalize-japanese' + lambda {|w| w.to_hiragana} + rescue LoadError + lambda {|w| w} + end } } end -- cgit v1.2.3