X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition.pm;h=9a0f8b508e273c3357fd0cd40f9cf010e6f559b8;hb=10943ab0b79fbd489f6beb3b81a13ed8cbcfafcf;hp=668383f692e3a35fbc8f6db206caf5396b2bb511;hpb=82fa4d574ae69634563ea89a5fd973f49b2d435c;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition.pm b/lib/Text/Tradition.pm index 668383f..9a0f8b5 100644 --- a/lib/Text/Tradition.pm +++ b/lib/Text/Tradition.pm @@ -8,7 +8,7 @@ use Text::Tradition::Stemma; use Text::Tradition::Witness; use vars qw( $VERSION ); -$VERSION = "0.3"; +$VERSION = "0.5"; has 'collation' => ( is => 'ro', @@ -54,6 +54,13 @@ has 'stemmata' => ( default => sub { [] }, ); +has 'initialized' => ( + is => 'ro', + isa => 'Bool', + default => undef, + writer => '_init_done', + ); + # Create the witness before trying to add it around 'add_witness' => sub { my $orig = shift; @@ -288,6 +295,7 @@ sub BUILD { $mod->can('parse')->( $self, $init_args ); } } + $self->_init_done( 1 ); return $self; } @@ -356,6 +364,17 @@ sub add_stemma { return $stemma; } +sub lemmatize { + my $self = shift; + unless( $self->has_language ) { + warn "Please set a language to lemmatize a tradition"; + return; + } + my $mod = "Text::Tradition::Language::" . $self->language; + load( $mod ); + $mod->can( 'lemmatize' )->( $self ); +} + no Moose; __PACKAGE__->meta->make_immutable;