| 1 | package Wiktionary::Parser::Section::Translations::WordSense; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use Wiktionary::Parser::Section::Translations::WordSense::Lexeme; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 24 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 6 | 24 | my $class = shift; | |||||||||
| 7 | 24 | my %args = @_; | |||||||||
| 8 | |||||||||||
| 9 | 24 | ▶ | die 'word_sense is not defined' unless defined $args{word_sense}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | |||||||||||
| 11 | 24 | my $self = bless \%args, $class; | |||||||||
| 12 | 24 | return $self; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 64 | ▶ | sub get_word { | ||||||||
|
Subroutine
get_word: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 16 | 64 | my $self = shift; | |||||||||
| 17 | 64 | return $self->{word_sense}; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub add_translation { | ||||||||
|
Subroutine
add_translation: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my $self = shift; | |||||||||
| 22 | 0 | my %args = @_; | |||||||||
| 23 | |||||||||||
| 24 | my $lexeme = Wiktionary::Parser::Section::Translations::WordSense::Lexeme->new( | ||||||||||
| 25 | language_code => $args{language_code}, | ||||||||||
| 26 | language_name => $args{language_name}, | ||||||||||
| 27 | lexeme => $args{translated_word}, | ||||||||||
| 28 | extra => $args{extra}, | ||||||||||
| 29 | 0 | ); | |||||||||
| 30 | 0 | $self->add_lexeme($lexeme); | |||||||||
| 31 | 0 | $self->{_last_lexeme} = $lexeme; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 432 | ▶ | sub add_lexeme { | ||||||||
|
Subroutine
add_lexeme: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | 432 | my $self = shift; | |||||||||
| 36 | 432 | my $lexeme = shift; | |||||||||
| 37 | 432 | my $lang = $lexeme->get_language_name(); | |||||||||
| 38 | 432 | ▶ | return unless $lang; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 404 | push @{$self->{languages}{$lang}}, $lexeme; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 20 | ▶ | sub get_translations { | ||||||||
|
Subroutine
get_translations: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 43 | 20 | my $self = shift; | |||||||||
| 44 | 20 | return $self->{languages}; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 3 | 1; | |||||||||