1 package Text::Tradition::Collation::Reading::WordForm;
3 use Lingua::Features::Structure;
9 Text::Tradition::Collation::Reading::WordForm - represents a
10 language/lemma/morphology triplet that can be associated with a Reading.
14 Text::Tradition is a library for representation and analysis of collated
15 texts, particularly medieval ones. A word form is used for the analysis of
16 Reading objects; it consists of a lemma, a language, and a code to
17 represent its part of speech. In general the word forms for a particular
18 language should be read from / written to some morphological database.
24 Creates a new word form from the passed options.
28 Returns the language to which this word form belongs.
32 Returns the lemma for the word form.
36 Returns an array representing this word's morphology. The contents of the
37 array depend on the language being used.
47 # TODO do we need this?
62 isa => 'Lingua::Features::Structure',
66 around BUILDARGS => sub {
69 my $args = @_ == 1 ? $_[0] : { @_ };
70 if( exists $args->{'JSON'} ) {
71 my $data = $args->{'JSON'};
72 my $morph = Lingua::Features::Structure->from_string( $data->{'morphology'} );
73 $data->{'morphology'} = $morph;
76 $class->$orig( $args );
81 Returns a string combination of language/lemma/morphology that can be used
82 in equivalence testing.
88 return JSON->new->convert_blessed(1)->encode( $self );
94 'language' => $self->language,
95 'lemma' => $self->lemma,
96 'morphology' => $self->morphology->to_string
101 __PACKAGE__->meta->make_immutable;
107 This package is free software and is provided "as is" without express
108 or implied warranty. You can redistribute it and/or modify it under
109 the same terms as Perl itself.
113 Tara L Andrews E<lt>aurum@cpan.orgE<gt>