I’m making good progress in creating a set of .net and Python wrappers for OpenFst.

Following on from my last post I have managed to create a single .net wrapper using the mergebin utility. It took a bit of hacking of the mergebin code and experimentation but I’m glad I’ve it working.

Now I want to take the integration one step further. For example what if the dll consumer wants to then merge it with their exe’s or additional libraries both managed or unmanaged.

Here is a quick C# snippet that will load an fst and iterate the states in outer loop and the arcs in the inner to print out the fst console. I’ve tried to use the the iterator support and foreach statement to make a clean looking syntax.

VectorFst fst = VectorFst.Read(@"t.ofst");

      if (fst != null)


        foreach (var s in fst.States)


          foreach (var a in fst.Arcs(s))


            Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", s, a.nextstate, a.ilabel, a.olabel, a.weight);




DSLs seem to be the current hotness and I’m seeing T4 mentioned a lot. I haven’t looked at T4 properly yet, but I’m thinking about if a text templating system might be good approach for generating parts of wrapper, such as methods common to all FST types or for generating semiring specialized methods.

This entry was posted by Edobashira. Bookmark the permalink.

4 thoughts on “ Update”

  1. Hi,

    I didn't work on the wrapper for some time. Recently I have been porting the whole library to C#. You can get the code here
    There is still a lot to implement but maybe it has the features you need already.

    Otherwise I can try and dig out the projects for the old wrappers.


Leave a Reply

Note: only a member of this blog may post a comment.