public static void main(String[] args) throws java.io.IOException { if (args.length == 0) { System.err.println("Usage: PerceptronModel modelname < contexts"); System.exit(1); } AbstractModel m = new PerceptronModelReader(new File(args[0])).getModel(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); DecimalFormat df = new java.text.DecimalFormat(".###"); for (String line = in.readLine(); line != null; line = in.readLine()) { String[] context = line.split(" "); double[] dist = m.eval(context); for (int oi=0;oi<dist.length;oi++) { System.out.print("["+m.getOutcome(oi)+" "+df.format(dist[oi])+"] "); } System.out.println(); } } }
public static void main(String[] args) throws java.io.IOException { if (args.length == 0) { System.err.println("Usage: PerceptronModel modelname < contexts"); System.exit(1); } AbstractModel m = new PerceptronModelReader(new File(args[0])).getModel(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); DecimalFormat df = new java.text.DecimalFormat(".###"); for (String line = in.readLine(); line != null; line = in.readLine()) { String[] context = line.split(" "); double[] dist = m.eval(context); for (int oi=0;oi<dist.length;oi++) { System.out.print("["+m.getOutcome(oi)+" "+df.format(dist[oi])+"] "); } System.out.println(); } } }
public static void main(String[] args) throws java.io.IOException { if (args.length == 0) { System.err.println("Usage: GISModel modelname < contexts"); System.exit(1); } AbstractModel m = new opennlp.maxent.io.SuffixSensitiveGISModelReader( new File(args[0])).getModel(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); DecimalFormat df = new java.text.DecimalFormat(".###"); for (String line = in.readLine(); line != null; line = in.readLine()) { String[] context = line.split(" "); double[] dist = m.eval(context); for (int oi = 0; oi < dist.length; oi++) { System.out.print("[" + m.getOutcome(oi) + " " + df.format(dist[oi]) + "] "); } System.out.println(); } } }
public static void main(String[] args) throws java.io.IOException { if (args.length == 0) { System.err.println("Usage: GISModel modelname < contexts"); System.exit(1); } AbstractModel m = new opennlp.maxent.io.SuffixSensitiveGISModelReader( new File(args[0])).getModel(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); DecimalFormat df = new java.text.DecimalFormat(".###"); for (String line = in.readLine(); line != null; line = in.readLine()) { String[] context = line.split(" "); double[] dist = m.eval(context); for (int oi = 0; oi < dist.length; oi++) { System.out.print("[" + m.getOutcome(oi) + " " + df.format(dist[oi]) + "] "); } System.out.println(); } } }