/*
This program will convert output file of  CRFF to SFF format.
It will combine input file in SFF format to POSTagger and output file of CRF.(not in SFF format)
Arguments will be  input file in SFF format and output file of CRF POSTagger(not in SFF format) and path of POSTagged file in SFF format.
*/

import java.io.BufferedReader;
import java.io.*;

public class CrfToSFF
{
     public static void main(String [] args)
     {

      try{

       String line="";
       File outFile = new File(args[2]);
       if(outFile.exists())
       {
        outFile.delete();
        outFile = new File(args[1]);
       }
       BufferedReader infile1 = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF8"));// input file in SFF format to POSTagger
       BufferedReader infile2 = new BufferedReader(new InputStreamReader(new FileInputStream(args[1]), "UTF8"));//output file of CRF

       UTFWriter outfile = new UTFWriter(outFile);
                     while((line = infile2.readLine()) != null)
                      {
                                String[] temp = line.split("\t");
                                    //outfile.writeUTF(temp[1]+"_[ NN ]  ");
                                System.out.println(temp[temp.length-1]);
                        }
                    infile2.close();
                    outfile.close();
         }
        catch(Exception e)
        {
                System.out.println(e.toString());
                e.printStackTrace();
        }
     }
}

