blib/lib/Uplug/IO/MosesWordAlign.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 2 SCAR 11.5
CC
2
Cov
0%
write
6.0
read
2.0
addheader
2.0
CRAP 3.1
1 #-*-perl-*-
2 #####################################################################
3 # Copyright (C) 2004 Jörg Tiedemann <joerg@stp.ling.uu.se>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #
19 # Uplug::IO::Tab - data records, row by row,
20 # separated by some delimiter symbol
21 #
22 #####################################################################
23 # $Author$
24 # $Id$
25  
26 package Uplug::IO::MosesWordAlign;
27  
28 use strict;
29 use vars qw(@ISA);
30 use Uplug::IO::Text;
31  
32 @ISA = qw( Uplug::IO::Text );
33  
34 #-------------------------------------------------------------------
35 #
36 # read is not implemented yet
37  
38 sub read{
39 my $self=shift;
40 my ($data)=@_;
41 die "read is not implemented for MosesWordAlign format ...";
42 }
43  
44  
45 # write is different from other streams: expects a array-ref with word-links (based on positions)
46  
47 sub write{
48 my $self = shift;
49 my $links = shift;
50  
51 die "no links found in Uplug::IO::MosesWordAlign::write!"
52 unless (ref($links) eq 'ARRAY');
53  
54 my $str = join(' ',sort { $a <=> $b } @{$links});
55  
56 my $fh=$self->{'FileHandle'};
57 return $self->writeToHandle($fh,$str."\n");
58 }
59  
60  
61 # no header!
62  
63 sub addheader{ }
64  
65 1;
66