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

remove Range in Fsa #14

Merged
merged 1 commit into from
Apr 26, 2020
Merged

Conversation

qindazhu
Copy link
Collaborator

No description provided.

@qindazhu
Copy link
Collaborator Author

qindazhu commented Apr 26, 2020

OK, updated with arc_indexes. Removed leaving_arcs and Range.

@qindazhu qindazhu force-pushed the haowen-fsa-property branch from c079cc4 to 524505d Compare April 26, 2020 13:03
@csukuangfj
Copy link
Collaborator

+2

merging.

@csukuangfj csukuangfj merged commit a960bf6 into k2-fsa:master Apr 26, 2020
@@ -33,18 +33,16 @@ bool IsValid(const Fsa &fsa) {
} else {
// every state contains at least one arc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an issue in previous code, but RE "only epsilon arcs enter the final state", this is not right, it should be kFinalSymbol (-1). You may have to change other code. This change is necessary, things will break later if you leave it as epsilon.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RE "every state contains at least one arc": firstly, you should word it as "every state has at least one arc leaving it". But actually this condition is not required for an FSA to be valid (it would just not be connected).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. also you should probably make it so that this code can't segfault even if the input is invalid.

return false;
state = arc.src_state;
num_arcs = 1;
}
}
// check the last state
if (final_state != state + 1) return false;
if ((fsa.leaving_arcs[final_state].begin - fsa.leaving_arcs[state].begin) !=
num_arcs)
if ((fsa.arc_indexes[final_state] - fsa.arc_indexes[state]) != num_arcs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... this code is hard for me to understand and to verify that it's correct. I think it would be much clearer if the iteration were done over fsa.arc_indexes.

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.

3 participants