guess-morph.pl 693 Bytes
Newer Older
priyank's avatar
priyank committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
while($line=<>)
{
	chomp($line);
	($id,$token,$pos,$fs)=split(/\t+/,$line);
	chomp($fs);
	if($pos eq "FRAGP"){
		$pos=~s/FRAGP/BLK/g;
	}
	if($fs=~/\|/)
	{
		$fs=~s/<fs af=\'|\'>//g;
		if(($fs) && ($fs=~/\|/))
		{
			($fs1,$fs2,$fs3,$fs4)=split(/\|/,$fs);
			($root1,$lcat1,$g1,$n1,$p1,$c1,$tam1,$suff1)=split(/,/,$fs1);
			($root2,$lcat2,$g2,$n2,$p2,$c2,$tam2,$suff2)=split(/,/,$fs2);
			if(($suff1 eq "0_o")&&($suff2 eq "lo"))
			{
				$fs1 ="" ;
			}	
		}
		$fst1= "$id\t$token\t$pos\t<fs af='$fs2'>";
		$fst2= "$id\t$token\t$pos\t<fs af='$fs1'>|<fs af='$fs2'>";
		if($fs1 eq "") {
			print "$fst1\n";
		}
		else {
			print "$fst2\n";
		}
	}
	else {
		print "$id\t$token\t$pos\t$fs\n";
	}
}