ardibehest has asked for the wisdom of the Perl Monks concerning the following question:
#!/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];How do I integrate such cases in the script. A couple of examples would suffice. Many thanks for helpAbbr["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."];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting a Sentence
by AppleFritter (Vicar) on Jul 03, 2014 at 10:56 UTC | |
by SimonPratt (Friar) on Jul 03, 2014 at 16:00 UTC | |
by AppleFritter (Vicar) on Jul 03, 2014 at 16:34 UTC | |
by ardibehest (Novice) on Jul 03, 2014 at 14:50 UTC | |
|
Re: Splitting a Sentence
by Tux (Canon) on Jul 03, 2014 at 10:56 UTC | |
by johngg (Canon) on Jul 03, 2014 at 11:29 UTC | |
|
Re: Splitting a Sentence
by tangent (Parson) on Jul 03, 2014 at 16:32 UTC | |
|
Re: Splitting a Sentence
by InfiniteSilence (Curate) on Jul 03, 2014 at 14:14 UTC | |
by ardibehest (Novice) on Jul 03, 2014 at 14:42 UTC | |
by RonW (Parson) on Jul 03, 2014 at 16:44 UTC | |
|
Re: Splitting a Sentence
by Anonymous Monk on Jul 03, 2014 at 10:13 UTC | |
by choroba (Cardinal) on Jul 03, 2014 at 10:51 UTC | |
by Anonymous Monk on Jul 04, 2014 at 07:14 UTC |