Beispiel #1
0
        public void ComposeEpsilon_Test()
        {
            URL url = new URL(Helper.FilesDirectory + "/fst/algorithms/composeeps/A.fst.txt");

            String path = url.File.DirectoryName + "/A";
            Fst    fstA = Convert.ImportFst(path, new TropicalSemiring());

            path = url.File.DirectoryName + "/B";
            Fst fstB = Convert.ImportFst(path, new TropicalSemiring());

            path = Path.Combine(url.File.DirectoryName, "fstcomposeeps");
            Fst fstC = Convert.ImportFst(path, new TropicalSemiring());

            Fst fstComposed = Compose.Get(fstA, fstB, new TropicalSemiring());

            Assert.AreEqual(fstC, fstComposed);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine("Input and output files not provided");
                Console.WriteLine("You need to provide both the input binary openfst model");
                Console.WriteLine("and the output serialized java fst model.");
                Environment.Exit(1);
            }

            //Serialize the java fst model to disk
            Fst fst = Convert.ImportFst(args[0], new TropicalSemiring());

            Console.WriteLine("Saving as binar java fst model...");
            try
            {
                fst.SaveModel(args[1]);
            }
            catch (IOException ex)
            {
                Console.WriteLine("Cannot write to file " + args[1]);
                Environment.Exit(1);
            }
        }