« Tool/EnglishMorpho/exceptions/nouns_irregular.pl
↑ Summary
Tool/EnglishMorpho/exceptions/verbs_irregular.pl »
| 1 | package Treex::Tool::Tagger::Featurama::EN; | ||||||||||
| 2 | 1 | $Treex::Tool::Tagger::Featurama::EN::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 Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | extends 'Treex::Tool::Tagger::Featurama'; | |||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Treex::Tool::EnglishMorpho::Analysis; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | has _analyzer => ( | |||||||||
| 11 | is => 'ro', | ||||||||||
| 12 | isa => 'Treex::Tool::EnglishMorpho::Analysis', | ||||||||||
| 13 | builder => '_build_analyzer', | ||||||||||
| 14 | lazy => 1, | ||||||||||
| 15 | init_arg => undef, | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub BUILDARGS { | ||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 19 | 0 | return { path => 'data/models/tagger/featurama/en/default' }; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub _build_analyzer { | ||||||||
|
Subroutine
_build_analyzer: not called CC=1 SCAR=6.9
| |||||||||||
| 23 | 0 | my $self = shift; | |||||||||
| 24 | 0 | return Treex::Tool::EnglishMorpho::Analysis->new(); | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | override '_analyze' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | 0 | my ( $self, $wordform ) = @_; | |||||||||
| 29 | |||||||||||
| 30 | return map { | ||||||||||
| 31 | 0 | { | |||||||||
| 32 | 0 | tag => $_, | |||||||||
| 33 | lemma => $wordform, | ||||||||||
| 34 | } | ||||||||||
| 35 | } ( $self->_analyzer->get_possible_tags($wordform) ); | ||||||||||
| 36 | 1 | }; | |||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | override '_get_feature_names' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 39 | 0 | return qw(Form Prefix1 Prefix2 Prefix3 Prefix4 Prefix5 Prefix6 Prefix7 Prefix8 Prefix9 Suffix1 Suffix2 | |||||||||
| 40 | Suffix3 Suffix4 Suffix5 Suffix6 Suffix7 Suffix8 Suffix9 Num Cap Dash Tag); | ||||||||||
| 41 | 1 | }; | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | override '_get_features' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||
| 44 | |||||||||||
| 45 | 0 | my ( $self, $forms, $analyses, $i ) = @_; | |||||||||
| 46 | 0 | my $wordform = $forms->[$i]; | |||||||||
| 47 | 0 | my $analysis = $analyses->[$i]; | |||||||||
| 48 | |||||||||||
| 49 | 0 | my @features; | |||||||||
| 50 | |||||||||||
| 51 | #Form | ||||||||||
| 52 | 0 | push( @features, $wordform ); | |||||||||
| 53 | |||||||||||
| 54 | #Prefixes | ||||||||||
| 55 | 0 | push( @features, substr( $wordform, 0, 1 ) ); | |||||||||
| 56 | 0 | push( @features, substr( $wordform, 0, 2 ) ); | |||||||||
| 57 | 0 | push( @features, substr( $wordform, 0, 3 ) ); | |||||||||
| 58 | 0 | push( @features, substr( $wordform, 0, 4 ) ); | |||||||||
| 59 | 0 | push( @features, substr( $wordform, 0, 5 ) ); | |||||||||
| 60 | 0 | push( @features, substr( $wordform, 0, 6 ) ); | |||||||||
| 61 | 0 | push( @features, substr( $wordform, 0, 7 ) ); | |||||||||
| 62 | 0 | push( @features, substr( $wordform, 0, 8 ) ); | |||||||||
| 63 | 0 | push( @features, substr( $wordform, 0, 9 ) ); | |||||||||
| 64 | |||||||||||
| 65 | #Suffixes | ||||||||||
| 66 | 0 | push( @features, substr( $wordform, -1, 1 ) ); | |||||||||
| 67 | 0 | push( @features, substr( $wordform, -2, 2 ) ); | |||||||||
| 68 | 0 | push( @features, substr( $wordform, -3, 3 ) ); | |||||||||
| 69 | 0 | push( @features, substr( $wordform, -4, 4 ) ); | |||||||||
| 70 | 0 | push( @features, substr( $wordform, -5, 5 ) ); | |||||||||
| 71 | 0 | push( @features, substr( $wordform, -6, 6 ) ); | |||||||||
| 72 | 0 | push( @features, substr( $wordform, -7, 7 ) ); | |||||||||
| 73 | 0 | push( @features, substr( $wordform, -8, 8 ) ); | |||||||||
| 74 | 0 | push( @features, substr( $wordform, -9, 9 ) ); | |||||||||
| 75 | |||||||||||
| 76 | #Num | ||||||||||
| 77 | 0 | ▶ | push( @features, $wordform =~ /[0-9]/ ? 1 : 0 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | |||||||||||
| 79 | #Cap | ||||||||||
| 80 | 0 | ▶ | push( @features, $wordform =~ /[[:upper:]]/ ? 1 : 0 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 81 | |||||||||||
| 82 | #Dash | ||||||||||
| 83 | 0 | ▶ | push( @features, $wordform =~ /-/ ? 1 : 0 ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | |||||||||||
| 85 | # Tag | ||||||||||
| 86 | 0 | push( @features, "NULL" ); | |||||||||
| 87 | |||||||||||
| 88 | # Analyses | ||||||||||
| 89 | 0 | push @features, map { $_->{'tag'} } @{$analysis}; | |||||||||
| 90 | 0 | return @features; | |||||||||
| 91 | 1 | }; | |||||||||
| 92 | |||||||||||
| 93 | 0 | ▶ | override '_extract_tag_and_lemma' => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 94 | 0 | my ( $self, $index, $wordform ) = @_; | |||||||||
| 95 | return { | ||||||||||
| 96 | 0 | tag => $self->perc->getProposedTag( $index, 0 ), | |||||||||
| 97 | lemma => $wordform, | ||||||||||
| 98 | }; | ||||||||||
| 99 | 1 | }; | |||||||||
| 100 | |||||||||||
| 101 | 1 | 1; | |||||||||
| 102 | |||||||||||
| 103 | __END__ | ||||||||||