From ea83bf53c1fa99231d68f53ff7e2b3d0645c8dd9 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Fri, 24 Oct 2014 15:31:16 -0400 Subject: conll2cdec conversion --- corpus/conll2cdec.pl | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 corpus/conll2cdec.pl (limited to 'corpus') diff --git a/corpus/conll2cdec.pl b/corpus/conll2cdec.pl new file mode 100755 index 00000000..f65b86f8 --- /dev/null +++ b/corpus/conll2cdec.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w +use strict; + +my @xx; +my @yy; +my @os; +my $sec = undef; +my $i = 0; +while(<>) { + chomp; + if (/^\s*$/) { + print "[$j]; + $sym =~ s/"/'/g; + push @oo, $sym; + } + my $zz = $j + 1; + print " feat$zz=\"@oo\""; + } + + print "> @xx ||| @yy \n"; + @xx = (); + @yy = (); + @os = (); + } else { + my ($x, @fs) = split /\s+/; + my $y = pop @fs; + if (!defined $sec) { $sec = scalar @fs; } + die unless $sec == scalar @fs; + push @xx, $x; + push @yy, $y; + push @os, \@fs; + } +} + -- cgit v1.2.3