X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition.pm;h=ce64e1dd307c7f434f3b3c4fdbc2dc747918b5c2;hb=378de72495d704d9de710a0b9c6cfec146de7886;hp=668383f692e3a35fbc8f6db206caf5396b2bb511;hpb=82fa4d574ae69634563ea89a5fd973f49b2d435c;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition.pm b/lib/Text/Tradition.pm index 668383f..ce64e1d 100644 --- a/lib/Text/Tradition.pm +++ b/lib/Text/Tradition.pm @@ -6,9 +6,10 @@ use Moose; use Text::Tradition::Collation; use Text::Tradition::Stemma; use Text::Tradition::Witness; +use Text::Tradition::User; use vars qw( $VERSION ); -$VERSION = "0.3"; +$VERSION = "0.5"; has 'collation' => ( is => 'ro', @@ -54,6 +55,28 @@ has 'stemmata' => ( default => sub { [] }, ); +has '_initialized' => ( + is => 'ro', + isa => 'Bool', + default => undef, + writer => '_init_done', + ); + +has 'user' => ( + is => 'rw', + isa => 'Text::Tradition::User', + required => 0, + predicate => 'has_user', + clearer => 'clear_user', + ); + +has 'public' => ( + is => 'rw', + isa => 'Bool', + required => 0, + default => sub { 0; }, + ); + # Create the witness before trying to add it around 'add_witness' => sub { my $orig = shift; @@ -288,6 +311,7 @@ sub BUILD { $mod->can('parse')->( $self, $init_args ); } } + $self->_init_done( 1 ); return $self; } @@ -356,6 +380,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;