Skip to content
Permalink
Browse files

- classify_hier.pl, MyCabocha.pm: Use only head noun for inter-senten…

…tial argument analysis.

- syncha: Version bumped.
- predict_case.pl: Eliminate duplicate 'GA'.
  • Loading branch information...
mamorlis committed Apr 20, 2007
1 parent e725330 commit c9fc1ae617a5502ba51a14f8bb033c89d4209d0f
Showing with 29 additions and 5 deletions.
  1. +1 −1 bin/syncha
  2. +8 −3 mugicha/bin/classify_hier.pl
  3. +1 −1 mugicha/bin/predict_case.pl
  4. +19 −0 mugicha/lib/MyCabocha.pm
@@ -59,7 +59,7 @@ chasen(1), mecab(1), cabocha(1)
use strict;
use warnings;

our $VERSION = qw(1.7);
our $VERSION = qw(1.8);

use Carp qw(croak);
use File::Temp qw(tempfile tempdir);
@@ -210,7 +210,7 @@ sub tournament {
my @context_nps;
for my $context (@{ $cab->get_text }) {
if ($context->get_id < $text->get_id) {
push @context_nps, @{ $context->get_np };
push @context_nps, @{ $context->get_head_np };
}
}
if (@nps <= 1) {
@@ -269,12 +269,17 @@ sub tournament {
set_event_arg($morph, $vframe, $winner);
} else {
# 文間にあるかもしれず
my $best_score = 0;
my $best_cand;
for my $cand (@context_nps) {
my $q = $cand->get_surface.$vframe;
if ($ncvtool->get_score($q) > 0) {
set_event_arg($morph, $vframe, $cand);
my $cand_score = $ncvtool->get_score($q);
if ($cand_score > $best_score) {
$best_score = $cand_score;
$best_cand = $cand;
}
}
set_event_arg($morph, $vframe, $best_cand) if $best_cand;
}
#print STDERR XMLout($tournament->xml, RootName => 'Tournament');
}
@@ -12,7 +12,7 @@ sub predict_case {
my $morph = shift; # Morph
my @type = ('GA');
if ($morph->get_type eq 'event') {
my %case = ( '¤¬' => 'GA', '¤ò'=>'WO', '¤Ë'=>'NI' );
my %case = ( '¤ò'=>'WO', '¤Ë'=>'NI' );
for my $case (keys %case) {
my $q = $case.':'.$morph->get_surface.'¤¹¤ë';
my $score = $ncvtool->get_score($q);
@@ -368,6 +368,25 @@ sub get_np {
return \@nps;
}

=item * get_head_np
=cut

sub get_head_np {
my $self = shift;

my @nps;

for my $chunk (@{ $self->get_chunk }) {
my $head = $chunk->get_head;
if ($head->get_pos =~ m/^名詞/gmx) {
push @nps, $head;
}
}

return \@nps;
}

=item * get_chunk_by_id
=cut

0 comments on commit c9fc1ae

Please sign in to comment.
You can’t perform that action at this time.