| 1 | package Lingua::JA::Summarize::Extract::Plugin::Sentence::Tiny; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use base qw( Lingua::JA::Summarize::Extract::Plugin ); | ||
| 5 | |||
| 6 | sub sentence { | ||
| 7 | my $self = shift; | ||
| 8 | my $text = $self->text; | ||
| 9 | |||
| 10 | $text =~ s/[ \x{3000}]+/ /g; | ||
| 11 | $text =~ s/[\x{3001}\x{3002}]/\n/g; | ||
| 12 | $text =~ s/[\r\n]+/\n/g; | ||
| 13 | |||
| 14 | my $i = 1; | ||
| 15 | my @sentence = map { { line => $i++, text => $_ } } split /\n/, $text; | ||
| 16 | \@sentence; | ||
| 17 | } | ||
| 18 | |||
| 19 | 1; |