简体   繁体   中英

What is the best way to implement a FSA/FSM in Java

I have a big finite state automaton with like 50 states and each state has avg. 3-4 transitions to other states. So I don't think the "state pattern" is suitable for this. This FSM tends to be a spellchecker and morphological analyzer for some agglutinative language.

What is the best way to implement a FSA/FSM in Java or should I use an open source library. Since natural languages are not regular (have exception cases), is there a way to make this implementation flexible for such situations.

Thanks

It seems like it would be straightforward to implement this as a directed, labelled graph. Perhaps there are graph libraries for Java that would be appropriate for this too, however I have no experience with them so I will leave it to others to make specific recommendations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM