Text::Tradition::Parser::BaseText(3)

NAME
Text::Tradition::Parser::BaseText

SYNOPSIS
use Text::Tradition::Parser::BaseText qw( merge_base ); merge_base( $graph, 'reference.txt', @apparatus_entries )

DESCRIPTION
For an overview of the package, see the documentation for the Text::Tradition module.

This module is meant for use with certain of the other Parser classes - whenever a list of variants is given with reference to a base text, these must be joined into a single collation. The parser should therefore make a list of variants and their locations, and BaseText will join those listed variants onto the reference text.

SUBROUTINES

parse
    parse( $graph, $opts );

    Takes an initialized graph and a hashref of options, which must include: - 'base' - the base text referenced by the variants - 'format' - the format of the variant list - 'data' - the variants, in the given format.

merge_base
    merge_base( $graph, 'reference.txt', @apparatus_entries )

    Takes three arguments: a newly-initialized Text::Tradition::Graph object, a text file containing the reference text, and a list of variants (apparatus entries). Adds the base text to the graph, and joins the variants to that.

    The list of variants is an array of hash references; each hash takes the form
     { '_id' => line reference,
       'rdg_0' => lemma reading,
       'rdg_1' => first variant,
       ... # and so on until all distinct readings are listed
       'WitnessA' => 'rdg_0',
       'WitnessB' => 'rdg_1',
       ... # and so on until all witnesses are listed with their readings
     }

    Any hash key that is not of the form /^rdg_\d+$/ and that does not begin with an underscore is assumed to be a witness name. Any 'meta' information to be passed must be passed in a key with a leading underscore in its name.

read_base
    my @line_beginnings = read_base( 'reference.txt', $collation );

    Takes a text file and a (presumed empty) collation object, adds the words as simple linear readings to the collation, and returns a list of readings that represent the beginning of lines. This collation is now the starting point for application of apparatus entries in merge_base, e.g. from a CSV file or a Classical Text Editor file.

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