public static void fst_copy_reverse(IGenericFst dst, IGenericFst src, bool no_accept = false)
{
dst.Clear();
int n = src.nStates();
for (int i = 0; i <= n; i++)
dst.NewState();
if (!no_accept)
dst.SetAccept(src.GetStart());
dst.SetStart(n);
for (int i = 0; i < n; i++)
{
dst.AddTransition(n, i, 0, src.GetAcceptCost(i), 0);
Intarray targets = new Intarray(), outputs = new Intarray(), inputs = new Intarray();
Floatarray costs = new Floatarray();
src.Arcs(inputs, targets, outputs, costs, i);
if (inputs.Length() != targets.Length())
throw new Exception("ASSERT: inputs.length() == targets.length()");
if (inputs.Length() != outputs.Length())
throw new Exception("ASSERT: inputs.length() == outputs.length()");
if (inputs.Length() != costs.Length())
throw new Exception("ASSERT: inputs.length() == costs.length()");
for (int j = 0; j < inputs.Length(); j++)
dst.AddTransition(targets.At1d(j), i, outputs.At1d(j), costs.At1d(j), inputs.At1d(j));
}
}