The Weighted Finite Automaton Inference Problem