Debian Codegraph @

README

raw
1
2 NAME
3
4 Lingua::EN::Sentence - split text into sentences
5
6 SYNOPSIS
7
8 use Lingua::EN::Sentence qw( get_sentences add_acronyms );
9
10 add_acronyms('lt','gen'); ## adding support for 'Lt. Gen.'
11 my $text = q{
12 A sentence usually ends with a dot, exclamation or question mark optionally followed by a space!
13 A string followed by 2 carriage returns denotes a sentence, even though it doesn't end in a dot
14
15 Dots after single letters such as U.S.A. or in numbers like -12.34 will not cause a split
16 as well as common abbreviations such as Dr. I. Smith, Ms. A.B. Jones, Apr. Calif. Esq.
17 and (some text) ellipsis such as ... or . . are ignored.
18 Some valid cases canot be deteected, such as the answer is X. It cannot easily be
19 differentiated from the single letter-dot sequence to abbreviate a person's given name.
20 Numbered points within a sentence will not cause a split 1. Like this one.
21 See the code for all the rules that apply.
22 This string has 7 sentences.
23 };
24
25 my $sentences=get_sentences($text); # Get the sentences.
26 foreach my $sent (@$sentences)
27 {
28 $i++;
29 print("SENTENCE $i:$sent\n");
30 }
31
32
33 DESCRIPTION
34
35 The C<Lingua::EN::Sentence> module contains the function get_sentences, which
36 splits text into its constituent sentences, based on a regular expression and a
37 list of abbreviations (built in and given).
38
39 Certain well know exceptions, such as abbreviations, may cause incorrect
40 segmentations. But some of them are already integrated into this code and are
41 being taken care of. Still, if you see that there are words causing the
42 get_sentences function to fail, you can add those to the module, so it notices them.
43 Note that abbreviations are case sensitive, so 'Mrs.' is recognised but not 'mrs.'
44
45
46
47 INSTALLATION
48
49 To install this module, type the following:
50
51 perl Makefile.PL
52 make
53 make test
54 make install
55
56 or
57
58 perl Build.PL
59 build
60 build test
61 build install
62
63
64 MAINTAINER
65
66 This project was originated by Shlomo Yona. Currently maintained
67 by Kim Ryan