garvys-org / rustfst

Rust re-implementation of OpenFST - library for constructing, combining, optimizing, and searching weighted finite-state transducers (FSTs). A Python binding is also available.
https://docs.rs/rustfst
Other
144 stars 17 forks source link

Composition and O_LABEL_SORTED #164

Closed dmort27 closed 2 years ago

dmort27 commented 2 years ago

Thanks for producing an incredible piece of software!

I am attempting to compose two (moderately sized) wFSTs (I have used compose in other contexts without a problem). In this case, the program panics with the following message:

Properties are not known : O_LABEL_SORTED | NOT_O_LABEL_SORTED.

I assume that this is because compose doesn't know whether the transitions of the first wFST have been sorted by their output labels. They have. Is there a straightforward way of updating the FstProperties of the wFST to communicate this?

dmort27 commented 2 years ago

So far, here's what I've tried:

fst.set_properties(fst.properties() | FstProperties::O_LABEL_SORTED)

I was assuming that setting the properties of an FST to the bitwise or of the current properties and O_LABEL_SORTED would set the property O_LABEL_SORTED. However, this also does not seem to work. Would it help if I constructed a minimal example?

dmort27 commented 2 years ago

I figured this out. It was a problem with my test cases, not with the library or my way of setting properties.