Algorithms for Acyclic Weighted Finite-State Automata with Failure Arcs