Using Ragel for Hidden Markov Model generation

Edward Ocampo-Gooding edward... at
Fri Nov 3 15:19:18 UTC 2006

Hi Adrian,

> It might be possible to use Ragel as is. There is an experimental (and 
> undocumented) semantic condition feature which obeys the rules of NFA to 
> DFA conversion. A semantic condition is a block of code which is 
> associated with a transition. It must evaluate to true for the 
> transition to be taken. Conditions were introduced for the purpose of 
> parsing variable length fields. You could use them to do a roll of the 
> dice. Look in test/cond?.rl for examples of conditions.

That sounds great, thanks! I'll take a look at it this weekend.

> If conditions don't cut it, then modifying Ragel might be an option. 
> Though I don't know enough about HMMs to say for sure if it could be 
> done. How are HMMs specified?

It's usually specified by a matrix of probabilities, but that can be 
played around with. I'm actually writing a few pages on HMM usage in 
general and will be done in a few days. Would you be interested in 
reading a rough draft?

> I can tell you that Ragel was designed for producing deterministic 
> parsers. Internally it has no epsilon transitions. Machines are made 
> deterministic on the fly. So it doesn't have many of the features that 
> comprehensive state machine libraries like Grail+ have.

I'm not sure what the breadth of those features is like, but I took a 
look at the examples available at and from the looks 
of it, I don't really need those. All I'm after is a very efficient 
finite state machine with probabilities in its transitions and possibly 


More information about the ragel-users mailing list