1 package Text::Tradition;
4 use Text::Tradition::Collation;
5 use Text::Tradition::Witness;
9 isa => 'Text::Tradition::Collation',
10 writer => '_save_collation',
16 isa => 'ArrayRef[Text::Tradition::Witness]',
18 all_options => 'elements',
21 option_count => 'count',
22 sorted_options => 'sort',
27 my( $self, $init_args ) = @_;
28 print STDERR "Calling tradition build\n";
31 if( exists $init_args->{'witnesses'} ) {
32 # We got passed an uncollated list of witnesses. Make a
33 # witness object for each witness, and then send them to the
36 foreach my $wit ( %{$init_args->{'witnesses'}} ) {
37 # Each item in the list is either a string or an arrayref.
38 # If it's a string, it is a filename; if it's an arrayref,
39 # it is a tuple of 'sigil, file'. Handle either case.
41 if( ref( $wit ) eq 'ARRAY' ) {
42 $args = { 'sigil' => $wit->[0],
43 'file' => $wit->[1] };
45 $args = { 'sigil' => chr( $autosigil+65 ),
49 $self->witnesses->push( Text::Tradition::Witness->new( $args ) );
50 # TODO Now how to collate these?
53 # Else we got passed args intended for the collator.
54 $init_args->{'tradition'} = $self;
55 $self->_save_collation( Text::Tradition::Collation->new( %$init_args ) );
56 $self->witnesses( $self->collation->create_witnesses() );
60 # The user will usually be instantiating a Tradition object, and
61 # examining its collation. The information about the tradition can
62 # come via several routes:
63 # - graphML from CollateX or elsewhere, standalone
64 # - TEI parallel segmentation
65 # - Leuven-style spreadsheet of variants, converted to CSV, plus base text
66 # - apparatus pulled from CTE, plus base text
67 # From this we should be able to get basic witness information.
69 # Alternatively the user can just give us the uncollated texts. Then
70 # instead of passing a collation, s/he is passing a set of witnesses
71 # from which we will generate a collation. Those witnesses can be in
72 # plaintext or in TEI with certain constraints adopted.
74 # So the constructor for a tradition needs to take one of these infosets,
75 # and construct the collation and the witness objects.
78 __PACKAGE__->meta->make_immutable;