The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DTA::CAB::Format::TT - Datum parser: one-token-per-line text

SYNOPSIS

use DTA::CAB::Format::TT;

##========================================================================
## Constructors etc.

$fmt = DTA::CAB::Format::TT->new(%args);

##========================================================================
## Methods: Input

$fmt = $fmt->close();
$fmt = $fmt->fromString($string);
$doc = $fmt->parseDocument();

##========================================================================
## Methods: Output

$fmt = $fmt->flush();
$str = $fmt->toString();
$fmt = $fmt->putToken($tok);
$fmt = $fmt->putSentence($sent);
$fmt = $fmt->putDocument($doc);

DESCRIPTION

Globals

Variable: @ISA

DTA::CAB::Format::TT inherits from DTA::CAB::Format.

Filenames

DTA::CAB::Format::TT registers the filename regex:

/\.(?i:t|tt|ttt)$/

with DTA::CAB::Format.

Constructors etc.

new
$fmt = CLASS_OR_OBJ->new(%args);

%args, %$fmt:

##-- Input
doc => $doc,                    ##-- buffered input document
##
##-- Output
outbuf    => $stringBuffer,     ##-- buffered output
#level    => $formatLevel,      ##-- n/a
##
##-- Common
encoding => $inputEncoding,     ##-- default: UTF-8, where applicable

Methods: Persistence

noSaveKeys
@keys = $class_or_obj->noSaveKeys();

Returns list of keys not to be saved. This implementation returns qw(doc outbuf).

Methods: Input

close
$fmt = $fmt->close();

Override: close current input source, if any.

fromString
$fmt = $fmt->fromString($string);

Override: select input from string $string.

parseTTString
$fmt = $fmt->parseTTString($str)

Guts for fromString(): parse string $str into local document buffer $fmt->{doc}.

parseDocument
$doc = $fmt->parseDocument();

Override: just returns local document buffer $fmt->{doc}.

Methods: Output

flush
$fmt = $fmt->flush();

Override: flush accumulated output

toString
$str = $fmt->toString();
$str = $fmt->toString($formatLevel)

Override: flush buffered output document to byte-string. Just encodes string in $fmt->{outbuf}.

putToken
$fmt = $fmt->putToken($tok);

Override: token output.

putSentence
$fmt = $fmt->putSentence($sent);

Override: sentence output.

putDocument
$fmt = $fmt->putDocument($doc);

Override: document output.

EXAMPLE

An example file in the format accepted/generated by this module (with very long lines) is:

%% $s:lang=de
wie	[exlex] wie	[errid] ec	[lang] de	[xlit] l1=1 lx=1 l1s=wie	[hasmorph] 1	[morph/safe] 1	[moot/word] wie	[moot/tag] PWAV	[moot/lemma] wie
oede	[xlit] l1=1 lx=1 l1s=oede	[morph/safe] 0	[moot/word] öde	[moot/tag] ADJD	[moot/lemma] öde
!	[exlex] !	[errid] ec	[xlit] l1=1 lx=1 l1s=!	[morph/safe] 1	[moot/word] !	[moot/tag] $.	[moot/lemma] !

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2019 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 924:

Non-ASCII character seen before =encoding in 'öde'. Assuming UTF-8