Text::Tradition - a software model for a set of collated texts


  use Text::Tradition;
  my $t = Text::Tradition->new( 
    'name' => 'this is a text',
    'input' => 'TEI',
    'file' => '/path/to/tei_parallel_seg_file.xml' );

  my @text_wits = $t->witnesses();
  my $manuscript_a = $t->witness( 'A' );

  $t = Text::Tradition->new();
  $t->add_witness( 'sourcetype' => 'xmldesc', 
    'file' => '/path/to/teitranscription.xml' );
  $t->add_witness( 'sourcetype => 'plaintext', 'sigil' => 'Q',
    'string' => 'The quick brown fox jumped over the lazy dogs' );
  ## TODO
  my $text_path_svg = $t->collation->as_svg();
  ## See Text::Tradition::Collation for more on text collation itself


Text::Tradition is a library for representation and analysis of collated texts, particularly medieval ones. A 'tradition' refers to the aggregation of surviving versions of a text, generally preserved in multiple manuscripts (or 'witnesses'). A Tradition object thus has one more more Witnesses, as well as a Collation that represents the unity of all versions of the text.



Creates and returns a new text tradition object. The following options are accepted.

General options:

name - The name of the text.

Initialization based on a collation file:

input - The input format of the collation file. Can be one of the following:
  • Self - a GraphML format produced by this module

  • CollateX - a GraphML format produced by CollateX

  • CTE - a TEI XML format produced by Classical Text Editor

  • JSON - an alignment table in JSON format, as produced by CollateX and other tools

  • TEI - a TEI parallel segmentation format file

  • Tabular - a spreadsheet collation. See the documentation for Text::Tradition::Parser::Tabular for an explanation of additional options.

file - The name of the file that contains the data. One of 'file' or 'string' should be specified.
string - A text string that contains the data. One of 'file' or 'string' should be specified.

Initialization based on a list of witnesses [NOT YET IMPLEMENTED]:

witnesses - A reference to an array of Text::Tradition::Witness objects that carry the text to be collated.
collator - A reference to a collation program that will accept Witness objects.


Return the Text::Tradition::Witness objects associated with this tradition, as an array.

witness( $sigil )

Returns the Text::Tradition::Witness object whose sigil is $sigil, or undef if there is no such object within the tradition.

add_witness( %opts )

Instantiate a new witness with the given options (see documentation for Text::Tradition::Witness) and add it to the tradition.

del_witness( $sigil )

Delete the witness with the given sigil from the tradition. Returns the witness object for the deleted witness.

rename_witness( $oldsigil, $newsigil )

Safely rename (i.e., assign a new sigil to) the given witness. At the moment this can only be done when the witness does not yet appear in the collation.


Blow away the existing collation object and mark all witnesses as uncollated. Not to be used lightly.

add_json_witnesses( $jsonstring, $options )

Adds a set of witnesses from a JSON array specification. This is a wrapper to parse the JSON and call add_witness (with the specified $options) for each element therein.


  • Allow tradition to be initialized via passing to a collator.


This package is free software and is provided "as is" without express or implied warranty. You can redistribute it and/or modify it under the same terms as Perl itself.


Tara L Andrews <>