store IDS data as text file instead of perl script.
authorimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:48:19 +0000 (13:48 +0000)
committerimiyazaki <imiyazaki>
Thu, 2 Sep 2004 13:48:19 +0000 (13:48 +0000)
use new CHISE DB structure.

Chise_utils/Chise_utils.pm

index 00d241a..a044631 100644 (file)
@@ -49,11 +49,30 @@ our $VERSION = '0.02';
 
 # Preloaded methods go here.
 
-$omegadb_path="/usr/local/lib/chise/omega";
+$omegadb_path="";
+unless($omegadb_path){
+    if(-w '/usr/local/share/chise/omega'){
+       $omegadb_path='/usr/local/share/chise/omega';
+    }elsif(-w '/usr/share/chise/omega'){
+       $omegadb_path='/usr/share/chise/omega';
+    }elsif(-w '/sw/share/chise/omega'){
+       $omegadb_path='/sw/share/chise/omega';
+    }elsif(-w '/usr/local/lib/chise/omega'){
+       $omegadb_path='/usr/local/lib/chise/omega';
+    }else{
+       $omegadb_path=".";
+    }
+}
 
 my $DB_HOME="";
 unless($DB_HOME){
-    if(-e '/usr/local/lib/chise/chise-db'){
+    if(-e '/usr/local/share/chise/0.3/db'){
+       $DB_HOME='/usr/local/share/chise/0.3/db';
+    }elsif(-e '/usr/share/chise/0.3/db'){
+       $DB_HOME='/usr/share/chise/0.3/db';
+    }elsif(-e '/sw/share/chise/0.3/db'){
+       $DB_HOME='/sw/share/chise/0.3/db';
+    }elsif(-e '/usr/local/lib/chise/chise-db'){
        $DB_HOME='/usr/local/lib/chise/chise-db';
     }elsif(-e '/usr/lib/chise/chise-db'){
        $DB_HOME='/usr/lib/chise/chise-db';
@@ -191,6 +210,7 @@ sub get_chars_containing{
     unless($db_opened{$atr}){
        &get_db($atr) or return ();
     }
+    utf8::encode($value);
     foreach $char (keys %{$chardb{$atr}}){
        if($chardb{$atr}->{$char}=~/$value/){
            utf8::decode($char);
@@ -208,6 +228,7 @@ sub get_chars_matching{
        unless($rdb_opened{$atr}){
            &get_reverse_db($atr) or return ();
        }
+       utf8::encode($value);
        if($char=$reverse_chardb{$atr}->{$value}){
            utf8::decode($char);
              $char=~s/^\?//;