remove punctuation handling logic; we will do this with relationships instead
[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
c84275ff 7 collated repetition transposition );
22222af9 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',
c84275ff 54 predicate => 'noncorr_set',
22222af9 55 );
56
57has 'non_independent' => (
58 is => 'ro',
59 isa => 'Bool',
c84275ff 60 predicate => 'nonind_set',
22222af9 61 );
62
63# A read-only meta-Boolean attribute.
64sub colocated {
65 my $self = shift;
66 return $self->type !~ /^(repetition|transposition)$/;
67}
68
69sub nonlocal {
70 my $self = shift;
71 return $self->scope ne 'local';
72}
73
74no Moose;
75__PACKAGE__->meta->make_immutable;
76
771;