constructing finite state machines for nlp 3816737