Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visualize FSA via GraphViz. #7

Merged
merged 1 commit into from
Apr 25, 2020

Conversation

csukuangfj
Copy link
Collaborator

I know it's difficult, if not impossible, to visualize an FSA with lots of states and transitions.

Visualization can be helpful to debug later algorithms, such as epsilon removal, trim, determinization ... ...


Visualization of the following fsa is given below.

  std::vector<Arc> arcs = {
      {0, 1, 2}, {0, 2, 1}, {1, 2, 0}, {1, 3, 5}, {2, 3, 6},
  };
  std::vector<Range> leaving_arcs = {
      {0, 2}, {2, 4}, {4, 5}, {0, 0},  // the last state has no leaving arcs
  };

abc

It is obtained by

./k2/csrc/fsa_renderer_test 2>&1 >/dev/null | dot -Tpng > abc.png

@danpovey
Copy link
Collaborator

Great! Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants