use File::Basename;
my @files = glob($ARGV[0]);

foreach my $file (@files){
    $filename = basename($file), "\n";
	$outfile = $filename;
	$outfile =~ s/\.[^.]+$//;
	$outfile .= ".txt";

#tt to sentences for parser
open(my $fh, '<:encoding(UTF-8)', $filename)   or die "Could not open file '$filename' $!";
open(my $out, '>:encoding(UTF-8)', $outfile);
while (my $line = <$fh>) {

$line =~ s/([^\t]+)\t([^\t]+)(\t(.+))?\n/\1\/\2 /g;
$line =~ s/\/NP/\/NNP/g;
$line =~ s/\/IN\/that/\/IN/g;
$line =~ s/\/PP/\/PRP/g;
$line =~ s/\/V[VH]/\/VB/g;
$line =~ s/\/SENT/\/./g;
$line =~ s/\(/-LRB-/g;
$line =~ s/\)/-RRB-/g;

if ($line =~ m/<\/s>/) {print $out "\n";}
if ($line !~ m/^</)
{
print $out $line;
}

}

close $out;
close $fh;

}
