Dear PerlMonks, I have a simple sentence splitter in Perl which does a pretty decent job of splitting a running text into sentences.
#!/usr/bin/perl use strict; use warnings; my $s; my @arr; open(FILE, "<test"); while(<FILE>) { chomp $_; $s .= $_; } @arr = $s =~ m/[A-Z].+?[.;]/g; foreach (@arr) { print $_, "\n"; }

However as you can see it stumbles on abbreviations and acronyms.

I have a list of abbreviations which I would like to integrate in the script but since I am a newbie to Perl, I have not been able to integrate them. I am giving below the list of such cases. The syntax is clear in the given cases

 Abbr["followed by the abbreviation];
Abbr["Co."]; Abbr["Corp."]; Abbr["vs."]; Abbr["e.g."]; Abbr["etc."]; Abbr["ex."]; Abbr["cf."]; Abbr["eg."]; Abbr["Jan."]; Abbr["Feb."]; Abbr["Mar."]; Abbr["Apr."]; Abbr["Jun."]; Abbr["Jul."]; Abbr["Aug."]; Abbr["Sep."]; Abbr["Sept."]; Abbr["Oct."]; Abbr["Nov."]; Abbr["Dec."]; Abbr["jan."]; Abbr["feb."]; Abbr["mar."]; Abbr["apr."]; Abbr["jun."]; Abbr["jul."]; Abbr["aug."]; Abbr["sep."]; Abbr["sept."]; Abbr["oct."]; Abbr["nov."]; Abbr["dec."]; Abbr["ed."]; Abbr["eds."]; Abbr["repr."]; Abbr["trans."]; Abbr["vol."]; Abbr["vols."]; Abbr["rev."]; Abbr["est."]; Abbr["b."]; Abbr["m."]; Abbr["bur."]; Abbr["d."]; Abbr["r."]; Abbr["M."]; Abbr["Dept."]; Abbr["MM."]; Abbr["U."]; Abbr["Mr."]; Abbr["Jr."]; Abbr["Ms."]; Abbr["Mme."]; Abbr["Mrs."]; Abbr["Dr."];
How do I integrate such cases in the script. A couple of examples would suffice. Many thanks for help

In reply to Splitting a Sentence by ardibehest

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.