| 1 | package Treex::Tool::Segment::EN::RuleBased; | ||
| 2 | 1 | $Treex::Tool::Segment::EN::RuleBased::VERSION = '2.20151102'; | |
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Treex::Core::Common; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | extends 'Treex::Tool::Segment::RuleBased'; | |
| 9 | |||
| 10 | # Note, that we cannot write | ||
| 11 | # sub get_unbreakers { return qr{...}; } | ||
| 12 | # because we want the regex to be compiled just once, not on every method call. | ||
| 13 | 1 | my $UNBREAKERS = qr{ | |
| 14 | \p{Upper} # single uppercase letters (with a rare exception of I) | ||
| 15 | |v|vs|i\.e|rev|e\.g # period-ending items that never indicate sentence breaks | ||
| 16 | |Adj|Adm|Adv|Asst # titles before names of persons, etc. | ||
| 17 | |Bart|Bldg|Brig|Bros|Capt|Cmdr|Col|Comdr|Con|Corp|Cpl|DR|Dr|Drs|Ens|Gen|Gov | ||
| 18 | |Hon|Hr|Hosp|Insp|Lt|MM|MR|MRS|MS|Maj|Messrs|Mlle|Mme|Mr|Mrs|Ms|Msgr|Op|Ord | ||
| 19 | |Pfc|Ph|Prof|Pvt|Rep|Reps|Res|Rev|Rt|Sen|Sens|Sfc|Sgt|Sr|St|Supt|Surg | ||
| 20 | }x; ## no critic (RegularExpressions::ProhibitComplexRegexes) this is nothing complex, just list | ||
| 21 | |||
| 22 | 0 | ▶ | override unbreakers => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 23 | 0 | return $UNBREAKERS; | |
| 24 | 1 | }; | |
| 25 | |||
| 26 | 1 | 1; | |
| 27 | |||
| 28 | __END__ | ||