1 package Text::Tradition::Language;
12 Text::Tradition::Language - add-on role to enable language awareness and
13 morphology functions to a Text::Tradition object. Please see
14 L<Text::Tradition::Morphology> for more information on the morphology
21 Accessor for the primary language of the tradition. Must correspond to one
22 of the Text::Tradition::Language::* modules in this package.
29 predicate => 'has_language',
32 before 'language' => sub {
34 if( @_ && $_[0] ne 'Default' ) {
35 # We are trying to set the language; check that the corresponding
37 eval "require Text::Tradition::Language::".$_[0];
39 throw( "Cannot load language module for @_: $@" );
46 Calls the appropriate lemmatization function for the language of the
53 unless( $self->has_language ) {
54 throw( "Please set a language to lemmatize a tradition" );
56 my $mod = "Text::Tradition::Language::" . $self->language;
58 $mod->can( 'lemmatize' )->( $self );