allow wordforms to be cleared out
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Reading / Lexeme.pm
index 98814e0..fa564ee 100644 (file)
@@ -3,6 +3,8 @@ package Text::Tradition::Collation::Reading::Lexeme;
 use Moose;
 use JSON ();
 use Module::Load;
+use Text::Tradition::Collation::Reading::WordForm;
+use Text::Tradition::Error;
 
 =head1 NAME
 
@@ -77,7 +79,9 @@ has 'wordform_matchlist' => (
                'matching_forms' => 'elements',
                'matching_form' => 'get',
                'add_matching_form' => 'push',
+               'clear_matching_forms' => 'clear',
                },
+       default => sub { [] },
        );
 
 has 'is_disambiguated' => (
@@ -186,6 +190,14 @@ sub TO_JSON {
        $hash->{'wordform_matchlist'} = [ $self->matching_forms ] if $self->matches;
        return $hash;
 }
+
+sub throw {
+       Text::Tradition::Error->throw( 
+               'ident' => 'Lexeme error',
+               'message' => $_[0],
+               );
+}
+
 no Moose;
 __PACKAGE__->meta->make_immutable;