3 # $Id: CHISE_REG.pm,v 1.2 2003-10-08 13:30:29 moro Exp $
14 overload::constant ( 'qr' => \&ChiseLikeRegex )
18 overload::remove_constant
21 # データベースの場を指。いずれはlibchiseに...
22 # データベースの全ファイルをchownしないとえないかも
24 if (-e '/usr/local/lib/chise/char-db') {
25 $DB_HOME = '/usr/local/lib/chise/char-db';
26 } elsif (-e '/sw/lib/xemacs-21.4.11/powerpc-apple-darwin6.6/char-db') {
27 $DB_HOME = '/sw/lib/xemacs-21.4.11/powerpc-apple-darwin6.6/char-db';
28 } elsif (-e '/usr/local/lib/xemacs-21.4.11/i686-pc-linux/char-db') {
29 $DB_HOME = '/usr/local/lib/xemacs-21.4.11/i686-pc-linux/char-db';
30 } elsif (-e '/usr/local/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db') {
31 $DB_HOME = '/usr/local/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db';
32 } elsif (-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db'){
33 $DB_HOME = '/usr/local/xemacs-utf2000/lib/xemacs-21.4.11/powerpc-apple-darwin6.4/char-db';
34 } elsif (-e '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db') {
35 $DB_HOME = '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db';
36 } elsif (-e '/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db') {
37 $DB_HOME = '/usr/local/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db';
38 } elsif (-e '/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db'){
39 $DB_HOME = '/usr/local/xemacs-utf2000/lib/xemacs-21.4.10/powerpc-apple-darwin6.4/char-db';
40 } elsif (-e 'd:/work/chise/char-db'){
41 $DB_HOME = 'd:/work/chise/char-db';
43 print STDERR "CHISE_REG.pm: No database found.\n";
44 print STDERR "CHISE_REG.pm: Please set \$DB_HOME to CHISE.pm.\n";
48 #--- 正規表現のCHISE的拡張 ------------------------------------#
50 sub ChiseLikeRegex ($) {
52 my ($RegexLiteral) = @_;
53 #print STDERR "BEFORE: $RegexLiteral\n"; # for debug
55 =~ s/\\same_([^_]+)_(\d)/(??{CHISE_REG->chise_backref(\$$2,'$1')})/g;
56 #print STDERR "AFTER: $RegexLiteral\n"; # for debug
62 my ($backreference, $feature_name) = @_;
63 #print STDERR "backreference: $backreference\n"; # for debug
64 #print STDERR "feature name: $feature_name\n"; # for debug
65 my $result = `./chisereg.pl $backreference $DB_HOME $feature_name`;
66 #print STDERR $result, "\n"; # for debug