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

Lazy FstProperties + num_{input,output}_epsilons #113

Merged
merged 52 commits into from
Jun 11, 2020

Conversation

Garvys
Copy link
Collaborator

@Garvys Garvys commented May 24, 2020

Goal1 : Make the fst.properties() method behave similary in rustfst and in openfst. At the moment, in rustfst all the properties are re-computed each time the properties method is called. To do that, we need to iterate over the whole graph which is slow.
However, in openfst the properties are stored in the Fst object and modified each time a mutable operation is performed.

Goal2 : Maje the fst.num_input_epsilons() and fst.num_output_epsilons() methods behave similarly in rustfst and in openfst i.e by maintaining internal counters instead of iterating through all the Trs.

Added

  • Add compute_and_update_properties() method to MutableFst trait to compute the properties verified by the Fst and update the internal property bits.

Changed

  • Now the fst.properties() method returns the stored property bits instead of computing all the verified properties.
  • Now tr_sort no longer need a sorting closure but a struct implementing TrCompare.
    • ilabel_compare -> ILabelCompare
    • olabel_compare -> OLabelCompare
  • num_input_epsilons and num_output_epsilons are now required methods of the CoreFst trait instead of provided.
  • num_input_epsilons and num_output_epsilons are now much faster as they leverage internal counters instead of iterating through the Trs.

@Garvys Garvys changed the title Lazy FstProperties Lazy FstProperties + num_{input,output}_epsilons Jun 11, 2020
@Garvys Garvys marked this pull request as ready for review June 11, 2020 09:17
@Garvys Garvys merged commit 4cd2b56 into master Jun 11, 2020
@Garvys Garvys deleted the task/lazy_fst_properties branch June 11, 2020 09:27
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.

1 participant