The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Uplug::IO::Any - libraries for handling various kinds of input/output

SYNOPSIS

%InSpec = (
format => 'text',
file => $input_filename,
access_mode => 'read',
encoding => 'iso-8859-1' );
%OutSpec = (
format => 'xml',
file => $output_filename,
access_mode => 'overwrite',
root => 's' );
$input = new Uplug::IO::Any( \%InSpec )
$output = new Uplug::IO::Any( \%OutSpec )
$data=Uplug::Data->new();
while ($input->read($data)){
# do somwthing with the data
$output->write($data);
}
$input->close;
$output->close;

DESCRIPTION

This is a class factory for creating data streams of various kinds. Supported sub-classes are:

Uplug::IO::Text ........... plain text
Uplug::IO::XML ............ generic XML class
Uplug::IO::XCESAlign ...... XCES-based sentence alignment
Uplug::IO::MosesWordAlign . word alignment in Moses format
Uplug::IO::PlugXML ........ parallel corpus format (used in the project PLUG)
Uplug::IO::LWA ............ format used by the Linköping Word Aligner (PLUG)
Uplug::IO::LiuAlign ....... Linköping's parallel corpus format (PLUG)
Uplug::IO::DBM ............ databases using AnyDBM
Uplug::IO::Tab ............ tab-separated data
Uplug::IO::Storable ....... storable objects
Uplug::IO::Collection ..... generic class to combine several input streams

Methods

Constructor

$handler = new Uplug::IO::Any( \%spec, $format );

Create a new I/O handler according to the specifications of %spec and the optional format $format. If %spec includes the key stream name: Try to load the specifications of a named stream (see Uplug::Config for more information).

Accepted data formats:

IO-class format parameter
-----------------------------------------------
Uplug::IO::Text ........... text
Uplug::IO::XML ............ xml
Uplug::IO::XCESAlign ...... align | xces
Uplug::IO::MosesWordAlign . moses
Uplug::IO::PlugXML ........ plug
Uplug::IO::LWA ............ lwa
Uplug::IO::LiuAlign ....... liu | koma
Uplug::IO::DBM ............ dbm
Uplug::IO::Tab ............ tab | uwa tab
Uplug::IO::Storable ....... storable
Uplug::IO::Collection ..... collection

If no format is given: Check file name extension:

*.dbm ..................... Uplug::IO::DBM
*.uwa ..................... Uplug::IO::Tab
*.txt ..................... Uplug::IO::Text
*.xml ..................... Uplug::IO::XML

1 POD Error

The following errors were encountered while parsing the POD:

Around line 70:

Non-ASCII character seen before =encoding in 'Linköping'. Assuming CP1252