hooks for morphology tagging
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Reading.pm
index 80f737c..8a90092 100644 (file)
@@ -116,7 +116,48 @@ has 'rank' => (
     is => 'rw',
     isa => 'Int',
     predicate => 'has_rank',
+    clearer => 'clear_rank',
     );
+    
+## For morphological analysis
+
+has 'normal_form' => (
+       is => 'rw',
+       isa => 'Str',
+       predicate => 'has_normal_form',
+       );
+
+has 'lemma' => (
+       is => 'rw',
+       isa => 'Str',
+       predicate => 'has_lemma',
+       );
+
+has 'morphology' => (
+       is => 'rw',
+       isa => 'Str',
+       predicate => 'has_morphology',
+       );
+       
+has 'morph_possibilities' => (
+       is => 'ro',
+       isa => 'HashRef[Str]',
+       default => sub { {} },
+       );
+
+## For prefix/suffix readings
+
+has 'join_prior' => (
+       is => 'ro',
+       isa => 'Bool',
+       default => undef,
+       );
+       
+has 'join_next' => (
+       is => 'ro',
+       isa => 'Bool',
+       default => undef,
+       );
 
 
 around BUILDARGS => sub {
@@ -173,6 +214,17 @@ sub related_readings {
        return $self->collation->related_readings( $self, @_ );
 }
 
+=head2 witnesses 
+
+Calls Collation's reading_witnesses with $self as the first argument.
+
+=cut
+
+sub witnesses {
+       my $self = shift;
+       return $self->collation->reading_witnesses( $self, @_ );
+}
+
 =head2 predecessors
 
 Returns a list of Reading objects that immediately precede $self in the collation.
@@ -215,6 +267,11 @@ sub _stringify {
        return $self->id;
 }
 
+sub TO_JSON {
+       my $self = shift;
+       return $self->text;
+}
+
 no Moose;
 __PACKAGE__->meta->make_immutable;