« NewsExtractor/Role/ContentTextExtractor.pm
↑ Summary
NewsExtractor/SiteSpecificExtractor/www_ustv_com_tw.pm »
| 1 | package NewsExtractor::SiteSpecificExtractor::www_setn_com; | ||||||||||||||||||||
| 2 | 1 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use Moo; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | extends 'NewsExtractor::GenericExtractor'; | |||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => 'normalize_whitespace'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 0 | ▶ | sub journalist { | ||||||||||||||||||
|
Subroutine
journalist: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 9 | 0 | my ($self) = @_; | |||||||||||||||||||
| 10 | 0 | my $content_text = $self->content_text; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 0 | my @patterns = ( | |||||||||||||||||||
| 13 | qr{\b記者\s*([\p{Letter}、]+?)\s*/\s*(?:\p{Letter}+?)報導\b}, | ||||||||||||||||||||
| 14 | qr{\b文/([\p{Letter}、]+)\b}, | ||||||||||||||||||||
| 15 | qr{\b (?:三立準氣象 | \p{Letter}{2} 中心) / (\p{Letter}+?) 報導\b}x, | ||||||||||||||||||||
| 16 | qr{\b健康醫療網記者(\p{Letter}+?)/報導\n}x, | ||||||||||||||||||||
| 17 | qr{\b助理編輯/(\p{Letter}+?)\n}x | ||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 0 | my $name; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | for my $pat (@patterns) { | |||||||||||||||||||
| 23 | 0 | ($name) = $content_text =~ $pat; | |||||||||||||||||||
| 24 | 0 | ▶ | last if defined $name; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | ▶ | return $name && normalize_whitespace($name); | ||||||||||||||||||
|
Condition0%0/3
$name && normalize_whitespace($name)
MC/DC0%0/2
$name && normalize_whitespace($name)
$name
normalize_whitespace($name)
Truth table0%0/3
A && B
A= $nameB= normalize_whitespace($name)
| |||||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 1 | 1; | |||||||||||||||||||