0

What is the best way to detect a sequence of characters in python?

I'm trying to use transitions package by Tal yarkoni for creating fsm's based on input sequences. Then i want to use the created fsms for new sequence recognition. I'm storing the created fsm in a dict with sequence number as key.

All the fsms from the dictionary should make transition as per input chars. The one which reaches end state is the required sequence and the function should return the key.

Problem is that there is no concept of end state in the transitions fsm model. Is it possible to do this using transitions package?

1 Answer 1

1

There is no concept of end state, but you can define a state 'end' on each fsm and check for it (see 'checking state' in the git readme), or you could add a 'on enter' reference on the 'end' state and that function will be called when the 'end' state is entered.

Haven't seen transitions before, looks very nice, I like being able to produce the diagrams.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.