Show
Ignore:
Timestamp:
11/15/07 16:03:31 (12 months ago)
Author:
yappo
Message:

r12@haruna (orig r10): ko | 2006-06-21 23:16:40 +0900
add normalize rules
add city patterns


Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Geography-AddressExtract-Japan/trunk/lib/Geography/AddressExtract/Japan.pm

    r1573 r1574  
    7575    my($self, $right, $opt) = @_; 
    7676 
     77    # address position normalize 
    7778    if ($opt->{number} && $opt->{number} =~ /^([���������岼])/) { 
    7879        my $prefix = $1; 
     
    8485            $opt->{match_text} .= $append; 
    8586        } 
     87    } 
     88 
     89    if ($opt->{aza} && $opt->{aza} =~ /^([\p{Hiragana}\p{Katakana}])/) { 
     90        my $prefix = $1; 
     91        $opt->{aza} = ''; 
     92        $opt->{number} = ''; 
     93        $opt->{match_text} =~ s/^($opt->{city})\s*$prefix.+$/$1/; 
     94    } 
     95 
     96    if ($opt->{city} =~ /([\p{Hiragana}\p{Katakana}]+)$/) { 
     97        my $kana = $1; 
     98        $opt->{city} =~ s/$kana//; 
     99        $opt->{aza} = $kana; 
     100    } 
     101 
     102    if ($opt->{city} =~ /([\p{Hiragana}\p{Katakana}]+)$/) { 
     103        my $kana = $1; 
     104        $opt->{city} =~ s/$kana//; 
     105        $opt->{aza} = $kana; 
     106    } 
     107 
     108    if ($opt->{aza} && $opt->{aza} =~ /^[\p{Hiragana}\p{Katakana}]/ && !$opt->{number}) { 
     109        if ($right =~ /^[-���ݤΥ�( 
     110            (?:(?:(?:[�����͸����Ȭ����)?[�����͸����Ȭ�塻]+|\d+)|[a-zA-Z����) 
     111            (?:(?:��?)?[-���ݤΥ�?(?:(?:(?:[�����͸����Ȭ����)?[�����͸����Ȭ�塻]+|\d+)|[a-zA-Z����)��? 
     112            )/x) { 
     113            $opt->{number} = $1; 
     114            $opt->{match_text} .= $&; 
     115        } 
     116    } 
     117 
     118    if ($opt->{aza} && $opt->{aza} =~ /\p{Han}+([�Ƥˤ�ؤΤˤ���].*)$/) { 
     119        my $prefix = $1; 
     120        $opt->{aza} =~ s/$prefix$//; 
     121        $opt->{number} = ''; 
     122        $opt->{match_text} =~ s/($opt->{aza}).+$/$1/; 
    86123    } 
    87124