fsm

How do you even give an (openFST-made) FST input? Where does the output go?

一世执手 提交于 2019-11-30 08:09:16
Before I start, note that I'm using the linux shell (via using subprocess.call() from Python), and I am using openFST. I've been sifting through documents and questions about openFST, but I cannot seem to find an answer to this question: how does one actually give input to an openFST-defined, compiled and composed FST? Where does the output go? Do I simply execute 'fstproject'? If so, how would I, say, give it a string to transduce, and print the various transductions when the end-state(s) have been reached? I apologize if this question seems obvious. I'm not very familiar with openFST as of

Converting regular expression to finite state machine

﹥>﹥吖頭↗ 提交于 2019-11-30 07:37:59
would you have a hint at algorithm to convert any regular expression to a finite state machine. For instance, an algorithm parsing a regexp and adding states to the fsm appropriately? Any reference or deeper idea? I am writting this with Python Thanks and regards Use Michael Sipser's Introduction to the Theory of Computation . Chapter 1 gives detailed algorithms for converting a regular expression to a deterministic or non-deterministic finite-state automaton (DFA or NFA), in the context of proving their equivalence (a DFA, an NFA and a regular expression can match exactly the same classes of

Does C# include finite state machines?

馋奶兔 提交于 2019-11-29 20:11:15
I've recently read about the boost::statechart library (finite state machines) and I loved the concept. Does C# have a similar mechanism ? Or can it be implemented using a specific design pattern? Yes, C# has iterator blocks which are compiler-generated state machines. If you wish to implement you own state machine you can create custom implementations of the IEnumerable<T> and IEnumerator<T> interfaces. Both of these approaches highlight the .NET framework's implementation of the iterator pattern . .NET 4 Update 1 now supports it in the following class: System.Activities.Statements

Java enum-based state machine (FSM): Passing in events

可紊 提交于 2019-11-29 20:09:51
I'm using several enum-based state machines in my Android application. While these work very well, what I am looking for is a suggestion for how to elegantly receive events, typically from registered callbacks or from eventbus messages, into the currently active state. Of the many blogs and tutorials concerning enum-based FSMs, most of them give examples of state machines that consume data (e.g. parsers) rather than show how these FSMs may be driven from events. A typical state machine I'm using has this form: private State mState; public enum State { SOME_STATE { init() { ... } process() { ..

How do you even give an (openFST-made) FST input? Where does the output go?

六眼飞鱼酱① 提交于 2019-11-29 11:05:16
问题 Before I start, note that I'm using the linux shell (via using subprocess.call() from Python), and I am using openFST. I've been sifting through documents and questions about openFST, but I cannot seem to find an answer to this question: how does one actually give input to an openFST-defined, compiled and composed FST? Where does the output go? Do I simply execute 'fstproject'? If so, how would I, say, give it a string to transduce, and print the various transductions when the end-state(s)

Does C# include finite state machines?

淺唱寂寞╮ 提交于 2019-11-28 16:00:18
问题 I've recently read about the boost::statechart library (finite state machines) and I loved the concept. Does C# have a similar mechanism ? Or can it be implemented using a specific design pattern? 回答1: Yes, C# has iterator blocks which are compiler-generated state machines. If you wish to implement you own state machine you can create custom implementations of the IEnumerable<T> and IEnumerator<T> interfaces. Both of these approaches highlight the .NET framework's implementation of the

Java enum-based state machine (FSM): Passing in events

拥有回忆 提交于 2019-11-28 15:59:41
问题 I'm using several enum-based state machines in my Android application. While these work very well, what I am looking for is a suggestion for how to elegantly receive events, typically from registered callbacks or from eventbus messages, into the currently active state. Of the many blogs and tutorials concerning enum-based FSMs, most of them give examples of state machines that consume data (e.g. parsers) rather than show how these FSMs may be driven from events. A typical state machine I'm

Why is {a^nb^n | n >= 0} not regular?

六月ゝ 毕业季﹏ 提交于 2019-11-27 15:03:37
In a CS course I'm taking there is an example of a language that is not regular: {a^nb^n | n >= 0} I can understand that it is not regular since no Finite State Automaton/Machine can be written that validates and accepts this input since it lacks a memory component. (Please correct me if I'm wrong) The wikipedia entry on Regular Language also lists this example, but does not provide a (mathematical) proof why it is not regular. Can anyone enlighten me on this and provide proof for this, or point me too a good resource? cletus What you're looking for is Pumping lemma for regular languages .

How to determine if a regex is orthogonal to another regex?

眉间皱痕 提交于 2019-11-27 11:33:19
问题 I guess my question is best explained with an (simplified) example. Regex 1: ^\d+_[a-z]+$ Regex 2: ^\d*$ Regex 1 will never match a string where regex 2 matches. So let's say that regex 1 is orthogonal to regex 2. As many people asked what I meant by orthogonal I'll try to clarify it: Let S1 be the (infinite) set of strings where regex 1 matches. S2 is the set of strings where regex 2 matches. Regex 2 is orthogonal to regex 1 iff the intersection of S1 and S2 is empty. The regex ^\d_a$ would

Python state-machine design

*爱你&永不变心* 提交于 2019-11-27 10:10:26
Related to this Stack Overflow question (C state-machine design) , could you Stack Overflow folks share your Python state-machine design techniques with me (and the community)? At the moment, I am going for an engine based on the following: class TrackInfoHandler(object): def __init__(self): self._state="begin" self._acc="" ## ================================== Event callbacks def startElement(self, name, attrs): self._dispatch(("startElement", name, attrs)) def characters(self, ch): self._acc+=ch def endElement(self, name): self._dispatch(("endElement", self._acc)) self._acc="" ## ===========