Esempio n. 1
0
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.Error.WriteLine("Usage: GISModel modelname < contexts");
                Environment.Exit(1);
            }
            AbstractModel  m   = (new SuffixSensitiveGISModelReader(new Jfile(args[0]))).Model;
            BufferedReader @in = new BufferedReader(new InputStreamReader(new InputStream(Console.OpenStandardInput())));
            // TODO get from System.in
            DecimalFormat df = new DecimalFormat(".###");

            for (string line = @in.readLine(); line != null; line = @in.readLine())
            {
                string[] context = line.Split(" ", true);
                double[] dist    = m.eval(context);
                for (int oi = 0; oi < dist.Length; oi++)
                {
                    Console.Write("[" + m.getOutcome(oi) + " " + df.format(dist[oi]) + "] ");
                }
                Console.WriteLine();
            }
        }