| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Wiktionary::Parser::Section::Translations::WordSense; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 3441 | use Wiktionary::Parser::Section::Translations::WordSense::Lexeme; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 850 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | sub new { | 
| 6 | 24 |  |  | 24 | 0 | 46 | my $class = shift; | 
| 7 | 24 |  |  |  |  | 71 | my %args = @_; | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 24 | 50 |  |  |  | 6009 | die 'word_sense is not defined' unless defined $args{word_sense}; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 24 |  |  |  |  | 92 | my $self = bless \%args, $class; | 
| 12 | 24 |  |  |  |  | 123 | return $self; | 
| 13 |  |  |  |  |  |  | } | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub get_word { | 
| 16 | 64 |  |  | 64 | 0 | 95 | my $self = shift; | 
| 17 | 64 |  |  |  |  | 272 | return $self->{word_sense}; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | sub add_translation { | 
| 21 | 0 |  |  | 0 | 0 | 0 | my $self = shift; | 
| 22 | 0 |  |  |  |  | 0 | my %args = @_; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 0 |  |  |  |  | 0 | 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 |  |  |  |  |  |  | ); | 
| 30 | 0 |  |  |  |  | 0 | $self->add_lexeme($lexeme); | 
| 31 | 0 |  |  |  |  | 0 | $self->{_last_lexeme} = $lexeme; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub add_lexeme { | 
| 35 | 432 |  |  | 432 | 0 | 535 | my $self = shift; | 
| 36 | 432 |  |  |  |  | 532 | my $lexeme = shift; | 
| 37 | 432 |  |  |  |  | 1208 | my $lang = $lexeme->get_language_name(); | 
| 38 | 432 | 100 |  |  |  | 1064 | return unless $lang; | 
| 39 | 404 |  |  |  |  | 439 | push @{$self->{languages}{$lang}}, $lexeme; | 
|  | 404 |  |  |  |  | 2510 |  | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub get_translations { | 
| 43 | 20 |  |  | 20 | 0 | 30 | my $self = shift; | 
| 44 | 20 |  |  |  |  | 57 | return $self->{languages}; | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; |