NAME
Text::Tradition::Parser::JSON
SYNOPSIS
use Text::Tradition;
my $tradition = Text::Tradition->new(
'name' => 'my text',
'input' => 'JSON',
'string' => $json_encoded_utf8,
);
DESCRIPTION
Parser module for Text::Tradition to read a JSON alignment table format such as that produced by CollateX.
METHODS
parse( $tradition, $option_hash )
Takes an initialized tradition and a set of options; creates the appropriate nodes and edges on the graph, as well as the appropriate witness objects. The $option_hash must contain either a 'file' or a 'string' argument with the JSON structure to be parsed.
The structure of the JSON is thus:
{ alignment => [ { witness => "SIGIL",
tokens => [ { t => "TEXT" }, ... ] },
{ witness => "SIG2",
tokens => [ { t => "TEXT" }, ... ] },
... ],
};
Longer lacunae in the text, to be disregarded in cladistic analysis, may be represented with the meta-reading '#LACUNA#'. Multiple lacuna tags in sequence are collapsed into a single multi-reading lacuna.
If a witness name ends in the collation's ac_label, it will be treated as an extra layer of the 'main' witness whose sigil it shares.
make_nodes( $collation, $index, @tokenlist )
Create readings from the unique tokens in @tokenlist, and set their rank to $index. Returns an array of readings of the same size as the original @tokenlist.
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>