Text::Tradition::Witness(3)

NAME
Text::Tradition::Witness - a manuscript witness to a text tradition

SYNOPSIS
  use Text::Tradition::Witness;
  my $w = Text::Tradition::Witness->new(
    'sigil' => 'A',
    'identifier' => 'Oxford MS Ex.1932',
    );

DESCRIPTION
Text::Tradition::Witness is an object representation of a manuscript witness to a text tradition. A manuscript has a sigil (a short code that represents it in the wider tradition), an identifier (e.g. the library ID), and probably a text.

METHODS

  new
Create a new witness. Options include:

•   sigil - A short code to represent the manuscript. Required.

•   sourcetype - What sort of witness data this is. Options are 'xmldesc', 'plaintext', 'json', or 'collation' (the last should only be used by Collation parsers.)

•   file =item * string =item * object

    The data source for the witness. Use the appropriate option.

•   use_text - An initialization option. If the witness is read from a TEI document and more than one <text/> tag exists therein, the default behavior is to use the first defined text. If this is not desired, use_text should be set to an XPath expression that will select the correct text.

•   identifier - The recognized name of the manuscript, e.g. a library identifier. Taken from the msDesc element for a TEI file.

•   other_info - A freeform string for any other description of the manuscript.

  sigil
The sigil by which to identify this manuscript, which must conform to the specification for XML attribute strings (broadly speaking, it must begin with a letter and can have only a few sorts of punctuation characters in it.)

  identifier
A freeform name by which to identify the manuscript, which may be longer than the sigil. Defaults to 'Unidentified ms', but will be taken from the TEI msName attribute, or constructed from the settlement and idno if supplied.

  settlement
The city, town, etc. where the manuscript is held. Will be read from the TEI msDesc element if supplied.

  repository
The institution that holds the manuscript. Will be read from the TEI msDesc element if supplied.

  idno
The identification or call number of the manuscript. Will be read from the TEI msDesc element if supplied.

  text
An array of strings (words) that contains the text of the manuscript. This should not change after the witness has been instantiated, and the path through the collation should always match it.

  layertext
An array of strings (words) that contains the layered text, if any, of the manuscript. This should not change after the witness has been instantiated, and the path through the collation should always match it.

  identifier
Accessor method for the witness identifier.

  other_info
Accessor method for the general witness description.

  has_source
Boolean method that returns a true value if the witness was created with a data source (that is, a file, string, or object to be parsed).

  is_layered
Boolean method to note whether the witness has layers (e.g. pre-correction readings) in the collation.

  export_as_json
Exports the witness as a JSON structure, with the following keys:

•   id - The witness sigil

•   name - The witness identifier

•   tokens - An array of hashes of the form { "t":"WORD" }

BUGS / TODO

•   Figure out how to serialize a witness

•   Support encodings other than UTF-8

LICENSE
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.

AUTHOR
Tara L Andrews <aurum@cpan.org>