ease validation rules during collation init; fix bug in reading relationship merge
[scpubgit/stemmatology.git] / lib / Text / Tradition.pm
index 20ba383..9a0f8b5 100644 (file)
@@ -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;