DTA::CAB::Format::TT - Datum parser: one-token-per-line text
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);
DTA::CAB::Format::TT inherits from DTA::CAB::Format.
DTA::CAB::Format::TT registers the filename regex:
/\.(?i:t|tt|ttt)$/
with DTA::CAB::Format.
$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
@keys = $class_or_obj->noSaveKeys();
Returns list of keys not to be saved. This implementation returns qw(doc outbuf)
.
$fmt = $fmt->close();
Override: close current input source, if any.
$fmt = $fmt->fromString($string);
Override: select input from string $string.
$fmt = $fmt->parseTTString($str)
Guts for fromString(): parse string $str into local document buffer $fmt->{doc}.
$doc = $fmt->parseDocument();
Override: just returns local document buffer $fmt->{doc}.
$fmt = $fmt->flush();
Override: flush accumulated output
$str = $fmt->toString();
$str = $fmt->toString($formatLevel)
Override: flush buffered output document to byte-string. Just encodes string in $fmt->{outbuf}.
$fmt = $fmt->putToken($tok);
Override: token output.
$fmt = $fmt->putSentence($sent);
Override: sentence output.
$fmt = $fmt->putDocument($doc);
Override: document output.
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] !
Bryan Jurish <moocow@cpan.org>
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.
Hey! The above document had some coding errors, which are explained below:
Non-ASCII character seen before =encoding in 'öde'. Assuming UTF-8