package in.cdacn.nlp.ilmt; import gnu.getopt.Getopt; import java.io.FileNotFoundException; import java.io.IOException; import java.io.UnsupportedEncodingException; public class GuessMorph { static String stHomedirPath = null; static boolean isOutputFile = false; static boolean isDaemon = false; static int daemonPort = 0; public static void main(String[] args) { Getopt getoptChoice = new Getopt("GuessMorph", args, "i:o:u:p:d"); String input = null; boolean flag_fileoutput = false; String op_file = null; int option; while ((option = getoptChoice.getopt()) != -1) { switch (option) { case 100: isDaemon = true; break; case 112: daemonPort = Integer.parseInt(getoptChoice.getOptarg()); break; case 105: input = getoptChoice.getOptarg(); break; case 111: isOutputFile = true; op_file = getoptChoice.getOptarg(); break; case 117: stHomedirPath = getoptChoice.getOptarg(); } } try { if (input != null) new SSFReading().convertFile(input, op_file); else { if (daemonPort != 0) { new SSFReading().convertFile(null, op_file); } else { System.out.println("Please pass the port number to -p :)\n"); } } } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (UnsupportedEncodingException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } } }