prune_default.pl 646 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
#!/usr/bin/perl
sub prune_default{


	# Keep the first FS in the case of more than one
	$sent=@_[0];
	my($parent);
	my($fs,@attr,@index);
	@index = &get_leaves($sent);
	
	for($i=0 ; $i<=$#index ; $i++)
	{
		($f0,$f1,$f2,$f3,$f4) = &get_fields($index[$i],$sent);
		$fs_ptr = &read_FS($f4,$sent);

		#first, update all the category in the FS based on the POS

		$num_of_fs = &get_num_fs($fs_ptr,$sent);
		if($num_of_fs > 1)
		{
			for($j = 2; $j <= $num_of_fs; $j++)
			{
				$ret=&prune_FS("",$j,$fs_ptr,$sent);
			}
		}

		$string=&make_string($fs_ptr,$sent);
		&modify_field($index[$i],4,$string,$sent);
	}
}

1;