1 package Text::Tradition::Collation::Reading::WordForm;
4 use Lingua::Features::Structure;
8 Text::Tradition::Collation::Reading::WordForm - represents a
9 language/lemma/morphology triplet that can be associated with a Reading.
13 Text::Tradition is a library for representation and analysis of collated
14 texts, particularly medieval ones. A word form is used for the analysis of
15 Reading objects; it consists of a lemma, a language, and a code to
16 represent its part of speech. In general the word forms for a particular
17 language should be read from / written to some morphological database.
23 Creates a new word form from the passed options.
27 Returns the language to which this word form belongs.
31 Returns the lemma for the word form.
35 Returns an array representing this word's morphology. The contents of the
36 array depend on the language being used.
46 # TODO do we need this?
61 isa => 'Lingua::Features::Structure',
65 around BUILDARGS => sub {
68 my $args = @_ == 1 ? $_[0] : { @_ };
69 if( exists $args->{'serial'} ) {
70 my( $lang, $lemma, $morph ) = split( /\+\+/, delete $args->{'serial'} );
71 $args->{'language'} = $lang;
72 $args->{'lemma'} = $lemma;
73 $args->{'morphology'} = Lingua::Features::Structure->from_string( $morph );
75 $class->$orig( $args );
80 Returns a string combination of language/lemma/morphology that can be used
81 in equivalence testing.
87 return join( '++', $self->language, $self->lemma, $self->morphology->to_string );
91 __PACKAGE__->meta->make_immutable;
97 This package is free software and is provided "as is" without express
98 or implied warranty. You can redistribute it and/or modify it under
99 the same terms as Perl itself.
103 Tara L Andrews E<lt>aurum@cpan.orgE<gt>