#!/usr/bin/perl # Copyright 13th. October 2008, Cotman University # http://www.cotmanuniversity.com # Created by Dr. Peter Kjeldsen # Department for Computational Linguistics # Conversion of WordFast TM format to CSV format # File name: wfcsv.pl # # Instructions # Change name of input file, source and target language # as required. # Run from command prompt perl wfcsv.pl # # Opening input file open (TXT, "; close (TXT); # Opening/creating output file open (TM, ">>lingualizerwf.csv") or die ("Cannot open file!"); # Creating header for output file $header = '"Created by Lingualizer tmXl8tr","Created by Lingualizer tmXl8tr"' . "\n"; # Writing header in the output file print TM $header; # Looping through input file content line by line foreach $lines(@text) { # Splitting line content and creating translation units @line = split (/\t/, $lines); $source = $line[4]; $target = $line[6]; print TM '"' . "$source" . '","' . "$target" .'"'. "\n"; } # Closing output file close (TM);