make French morphology use Lingua objects; add tests
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Reading / WordForm.pm
CommitLineData
cca4f996 1package Text::Tradition::Collation::Reading::WordForm;
2
3use Moose;
4
5=head1 NAME
6
7Text::Tradition::Collation::Reading::WordForm - represents a
8language/lemma/morphology triplet that can be associated with a Reading.
9
10=head1 DESCRIPTION
11
12Text::Tradition is a library for representation and analysis of collated
13texts, particularly medieval ones. A word form is used for the analysis of
14Reading objects; it consists of a lemma, a language, and a code to
15represent its part of speech. In general the word forms for a particular
16language should be read from / written to some morphological database.
17
18=head1 METHODS
19
20=head2 new
21
22Creates a new word form from the passed options.
23
24=head2 language
25
26Returns the language to which this word form belongs.
27
28=head2 lemma
29
30Returns the lemma for the word form.
31
32=head2 morphology
33
34Returns an array representing this word's morphology. The contents of the
35array depend on the language being used.
36
37=cut
38
39has 'language' => (
40 is => 'ro',
41 isa => 'Str',
42 required => 1,
43 );
44
45# TODO do we need this?
46has 'form' => (
47 is => 'ro',
48 isa => 'Str',
49 # required => 1,
50 );
51
52has 'lemma' => (
53 is => 'ro',
54 isa => 'Str',
55 required => 1,
56 );
57
58has 'morphology' => (
59 is => 'ro',
6ad2ce78 60 isa => 'Lingua::Features::Structure',
cca4f996 61 required => 1,
62 );
63
6ad2ce78 64=head2 to_string
65
66Returns a string combination of language/lemma/morphology that can be used
67in equivalence testing.
68
69=cut
70
71sub to_string {
cca4f996 72 my $self = shift;
6ad2ce78 73 return join( '++', $self->language, $self->lemma, $self->morphology->to_string );
cca4f996 74}
6ad2ce78 75
cca4f996 76no Moose;
77__PACKAGE__->meta->make_immutable;
78
791;
80
81=head1 LICENSE
82
83This package is free software and is provided "as is" without express
84or implied warranty. You can redistribute it and/or modify it under
85the same terms as Perl itself.
86
87=head1 AUTHOR
88
89Tara L Andrews E<lt>aurum@cpan.orgE<gt>