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

Implement `WeaklyDivisibleSemiring` for `BooleanWeight` #284

Open bluebear94 opened 1 month ago

bluebear94 commented 1 month ago

According to the definition in the docs for WeaklyDivisibleSemiring, BooleanWeight (S = bool, + = |, * = &, 0 = false, 1 = true) should be weakly divisible: there are three combinations (x, y) such that x + y != 0:

In fact, BooleanWeight is divisible because the inverse of true is true.

This PR adds an implementation of WeaklyDivisibleSemiring for BooleanWeight.