break out punctuation from the rest of the reading text
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Relationship.pm
CommitLineData
22222af9 1package Text::Tradition::Collation::Relationship;
2
3use Moose;
4use Moose::Util::TypeConstraints;
5
6enum 'RelationshipType' => qw( spelling orthographic grammatical meaning lexical
7 collation repetition transposition );
8
9enum 'RelationshipScope' => qw( local tradition global );
10
11no Moose::Util::TypeConstraints;
12
13=over 4
14
15=item * type - Can be one of spelling, orthographic, grammatical, meaning, lexical, collated, repetition, transposition. All but the last two are only valid relationships between readings that occur at the same point in the text.
16
17=item * non_correctable - (Optional) True if the reading would not have been corrected independently.
18
19=item * non_independent - (Optional) True if the variant is unlikely to have occurred independently in unrelated witnesses.
20
21=item * scope - (Optional) A meta-attribute. Can be one of 'local', 'tradition', or 'global'. Denotes whether the relationship between the two readings holds always, independent of context, either within this tradition or across all traditions.
22
23=back
24
25=cut
26
27has 'type' => (
28 is => 'ro',
29 isa => 'RelationshipType',
30 required => 1,
31 );
32
33has 'reading_a' => (
34 is => 'ro',
35 isa => 'Str',
36 required => 1,
37 );
38
39has 'reading_b' => (
40 is => 'ro',
41 isa => 'Str',
42 required => 1,
43 );
44
45has 'scope' => (
46 is => 'ro',
47 isa => 'RelationshipScope',
48 default => 'local',
49 );
50
51has 'non_correctable' => (
52 is => 'ro',
53 isa => 'Bool',
54 );
55
56has 'non_independent' => (
57 is => 'ro',
58 isa => 'Bool',
59 );
60
61# A read-only meta-Boolean attribute.
62sub colocated {
63 my $self = shift;
64 return $self->type !~ /^(repetition|transposition)$/;
65}
66
67sub nonlocal {
68 my $self = shift;
69 return $self->scope ne 'local';
70}
71
72no Moose;
73__PACKAGE__->meta->make_immutable;
74
751;