1 package Text::Tradition::Witness;
4 # Sigil. Required identifier for a witness.
11 # Text. This is an array of strings (i.e. word tokens).
12 # TODO Think about how to handle this for the case of pre-prepared
13 # collations, where the tokens are in the graph already.
16 isa => 'ArrayRef[Str]',
19 # Source. This is where we read in the witness, if not from a
20 # pre-prepared collation. It is probably a filename.
28 if( $self->has_source ) {
29 # Read the file and initialize the text.
30 open( WITNESS, $self->source ) or die "Could not open "
31 . $self->file . "for reading";
32 # TODO support TEI as well as plaintext, sometime
36 push( @words, split( /\s+/, $_ ) );
39 $self->text( \@words );
44 __PACKAGE__->meta->make_immutable;