I am revisiting the problem of sentence splitting. I have a Perl Script which splits a para into sentences, but acronyms and short forms create an issue
#!/usr/bin/perl
use feature qw/say/;
use strict;
use warnings;
my $s;
my @arr;
while(<>) {
chomp $_;
$s .= $_ . " ";
}
@arr = $s =~ m/[A-Z].+?[.;](?=[^.;][A-Z]|\s*$)/g;
foreach (@arr) {
say;
}
I have identified a list of abbreviations from a large corpus (not necessarily exhaustive) which are given below and which I would like to integrate in the script but since I am still learning Perl, I have not been able to integrate them. I am giving below the list of such cases. The list is not complete and can be added to. The syntax is as under:
How do I integrate these and ensure that when the script encounters the above exceptions, it does not treat the full-stop as a sentence delimiter as in in the examples below?
Mr. Smith said today is Jun. 15th.
Jones Inc. filed for bankruptcy.
A couple of examples for such integration would suffice and I will integrate the rest.
Many thanks
Perhaps these cpan modules may help;I have not used the first, but I have used the second with success In addition to the links below, see post #9 in thread Using awk to find sentences. for for a demonstration ... cheers, drl