All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Binary serialization & deserialization support for FST caches.
- Binary serialization & deserialization support for Compose FST op state table.
0.8.0 - 2020-16-10
states_range
forExpandedFst
trait- feature
state-label-u32
is now supported. Label and StateId will be stored as u32 with this feature. compute_num_known_trs
forFstCache
trait.
0.7.4 - 2020-12-10
- Fix compilation with rust 1.41
0.7.3 - 2020-12-10
- Use
abs
in implementation offloat_approx_equal
.
0.7.2 - 2020-12-10
- Make
NomCustomError
public.
0.7.1 - 2020-12-10
- Added a
BuildHasher
generic parameter toSymbolTable
as well as a methodwith_hasher
. - Added the
optimize
algorithm. - Added the
approx_equal
method to the Semiring trait and implement it for all semirings in the crate. - In order to handle default parmeters, some algorithms now have multiple versions:
- Simple:
minimize
. Advanced:minimize_with_config
configurable throughMinimizeConfig
. - Simple:
push
. Advanced:push_with_config
configurable throughPushConfig
. - Simple:
push_weights
. Advanced:push_weights_with_config
configurable throughPushWeightsConfig
. - Simple:
shortest_distance
. Advanced:shortest_distance_with_config
configurable throughShortestDistanceConfig
. - Simple:
shortest_path
. Advanced:shortest_path_with_config
configurable throughShortestPathConfig
. - Simple:
isomorphic
. Advanced:isomorphic_with_config
configurable throughIsomorphicConfig
.
- Simple:
- Make
proptest_fst
public - Implement
FstOp
forDeref<FstOp>
andFstOp2
forDeref<FstOp2>
- Implement
TrMapper<S>
forDeref<TrMapper<S>>
- Expose in
prelude
, top crate constant, traits, structs. - Expose in
prelude
FstProperties
. - Expose in
prelude
tr_mappers
.
- Lazy implementation of the compose algorithm has been generalized to use the
Borrow
trait instead of theArc
object. - Change internal implementation of
SymbolTable
: now used a Vec and aHashMap
instead of twoHashMap
s. As a result, doesn't supportSymbolTable
with hole anymore. - Change implementation of
Default
forSymbolTable
object: now addsEPS
. equal_quantized
inExpandedFst
trait has been renamed toapprox_equal
- Fix bug in
reverse
happening when theFst
wasINITIAL_CYCLIC
. - Fix bug in
minimize
in the partitionning. - Make
ComposeFst
clonable if all the elements that compose it are clonable. - The
Matcher
object now has a trait bound on anFst
instead of on anExpandedFst
allowing composing lazy fsts. - Lazy implementation of the determinize algorithm has been generalized to use the
Borrow
trait instead of theArc
object. determinize
now requires a&Fst
instead of anArc
.- Fixed bug in
Determinize
:HashMap
->BTreeMap
forLabelMap
. NO_LABEL
andNO_STATE_ID
are now public.- Fixed bug in
RmEpsilon
: mutation had to be performed while iterating. QuantizeMapper
has now a configurable delta value with default set toKDELTA
- Replace
FstCache
implementation forArc<FstCache>
by the deref trait. acceptor_minimize
now public.from_op_and_cache
is now public forLazyFst
andLazyFst2
- Change
FstCache
API and added aCacheStatus
object to better differentiate, computed data and not yet computed. - Renaming
rustfst.algorithms.lazy_fst_revamp
->rustfst.algorithms.lazy
0.6.3 - 2020-16-09
- Added two new cache logics :
FirstCache
andSimpleVecCache
.
0.6.2 - 2020-16-09
- Add
From<Vec<Tr<W>>>
forTrsVec
- Introduce new iterators to iterate on a whole Fst:
FstIntoIterator
as a trait bound ofExpandedFst
.FstIterator
as a trait bound ofFst
.FstIteratorMut
as a trait bound ofMutableFst
- Add
take_final_weight
andtake_final_weight_unchecked
to MutableFst API. - Add
add_super_final_state
algorithm. - Add the
ReverseBack
trait that must be implemented for Semiring::ReverseWeight. Allows to avoid using transmute when we haveweight.reverse().reverse()
calls. - Implement
SerializableSemiring
forProbabilityWeight
- Add support for
SymbolTable
serialization while serializing a FST in binary format. - Implement Composition operation. Added support to LookAhead filter.
- W is now a trait parameter of all the Fst traits instead of an associated type.
- Re-organized most of the algorithms into their own modules.
- All the lazy fsts except
rm_epsilon
are now Send and Sync. - Remove the
TrIterator
in favor of theget_trs
method in the CoreFst trait. - Add method
read_from_const
toVectorFst
allowing to load aVectorFst
from aConstFst
file. - Add
compute_and_update_properties()
method toMutableFst
trait to compute the properties verified by theFst
and update the internal property bits. - Add support for
compose
inrustfst-cli
. - Implement
FstCache
forArc<FstCache>
. - Add a clear method for
SimpleHashMapCache
. - Add
len_trs
andlen_final_weights
as required methods of theFstCache
trait.
fst_convert
now consumes its input. Usefst_convert_from_ref
to pass a borrow.set_input_symbols
,set_output_symbols
,unset_input_symbols
,unset_output_symbols
andset_symts_from_fst
methods have been moved fromMutableFst
toFst
.- Remove
MutableFst
trait bound from input ofshortest_path
. ArcMap
now takes an immutable mapper as parameter.- Use anyhow instead of failure for errors.
- Renamed Arc as Tr (for transition)
- Renamed DynamicFst as LazyFst
- Semiring impls are required to be 'static
- SymbolTable are now wrapped in std::sync::Arc (instead of Rc)
- renamed unset_input_symbols and unset_output_symbols to take_*_symbols
- static FST struct are now Send and Sync
final_weight
method of theCoreFst
trait now returns a copy instead of a reference.- Fix an issue in
SccQueue
which made theis_empty()
call super slow. As a result, an important speed-up can be observed when running theshortest_path
algorithm. ComposeFst
now clonable.- Remove call to
collect_vec
when callingLabelReachable.reach()
. num_trs
andnum_trs_unchecked
are now mandatory methods of theFst
trait. This allows removing useless calls toArc::clone
.- 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 implementingTrCompare
.ilabel_compare
->ILabelCompare
olabel_compare
->OLabelCompare
num_input_epsilons
andnum_output_epsilons
are now required methods of theCoreFst
trait instead of provided.num_input_epsilons
andnum_output_epsilons
are now much faster as they leverage internal counters instead of iterating through the Trs.- Various optimizations to significantly speed-up composition including getting rid of
bimap
for internalStateTable
. - It now possible to specify the internal cache of a
ComposeFst
object. - Remove trait bound on Default in FstCache trait.
- Fix olabel display while drawing a FST if no symbol table is provided
- Fix computation of FstProperties. There was an issue with the ACYCLIC field.
- Use loose dependencies
0.5.0 - 2020-02-04
- Add
FstIterator
andFstIteratorMut
to iterate over states and arcs in a given FST without referencing the FST. - Implement
FstIterator
andFstIteratorMut
for ConstFst and VectorFst. - Add
AllocableFst
to control the wFst allocation:capacity
,reserve
,shrink_to_fit
- Implement
AllocableFst
for Vector Fst - Add
del_all_states
method in theMutableFst
trait to remove all the states in a Fst. - Add
set_input_symbols()
andset_output_symbols()
to theMutableFst
trait to attach aSymbolTable
to an Fst. - Add
input_symbols()
andoutput_symbols()
to theFst
trait to retrieve previously attachedSymbolTable
. - Add
replace
fst operations. - Change internal implementation of
Replace
,Determinize
andFactorWeight
to share more code by creating the traitFstImpl
and the structStateTable
. - Implement/Derive
Clone
/PartialEq
/PartialOrd
/Debug
for all internal structures when possible. - Added dynamic versions of some algorithms:
replace
->ReplaceFst
factor_weight
->FactorWeightFst
union
->UnionFst
concat
->ConcatFst
closure
->ClosureFst
rmepsilon
->RmEpsilonFst
- Added
delete_final_weight_unchecked
to theFst
trait and implement it forVectorFst
. - Added
SerializableSemiring
trait and implement it for mostSemiring
s. - All
Fst
that implementsSerializableFst
with aSemiring
implementingSerializableSemiring
can now be serialized/deserialized consistently with OpenFst. - Added
arc_type()
method torustfst::Arc
. - Added
write
andread
method to theSymbolTable
API to serialize and deserialize SymbolTable in binary format consistently with OpenFst. - Added
unset_input_symbols
andunset_output_symbols
methods to remove the symbol tables attached to a mutable fst. - Added
emplace_arc
andemplace_arc_unchecked
as provided methods to theMutableFst
trait. - Added
set_symts_from_fst
to MutableFst trait to copy the SymbolTable from anotherFst
. - Added
print_weights
field toDrawingConfig
to avoid print weights when desired.
- Make
KDELTA
public outside of the crate - Fix serialization into a DOT file by putting the
label
into quotes. - Remove
reserve
API fromMutableFst
, seeAllocableFst
for this API - Remove
Fst
trait bound onDisplay
. - Removed
closure_plus
andclosure_star
in favor ofclosure
with aClosureType
parameter. - Fixed bugs in
concat
,union
andclosure
. factor_weight
now takes as input a type implementingBorrow
instead of&fst
.replace
now takes as input a vector of types implementingBorrow
instead offst
.- Parse
FstFlags
when parsing binaryConstFst
andVectorFst
. Raise an error if the file contains a SymbolTable. Not yet supported. - Remove
TextParser
,BinarySerializer
andBinaryDeserializer
traits. AddSerializableFst
in replacement. - Fix: when serializing an
Fst
, now uses the result of thearc_type()
method instead of using an hardcoded value. Display
is no longer a trait bound ofSemiring
. However, it is required to implementSerializableSemiring
.- Use
BufWriter
when serializing aSymbolTable
object increasing the serialization speed. - Fix bug when the parsing of fst in binary format crashed because a symbol table was attached to the fst. The symbol tables are now retrieved directly from the fst file.
plus
andtimes
methods ofSemiring
now takes aBorrow
instead of anAsRef
. Remove trait bounds onAsRef<Self>
,Default
andSized
.- Add checks on
fst_type
andarc_type
when loading a binary fst. As a result, for instance, loading aConstFst
with aVectorFst
file will trigger a nice error. SymbolTable
attached to anFst
are now used when drawing it.- Change parameter from W to Into for
add_arc
,set_final_unchecked
andset_final
methods. MutableFst
now has a trait bound onExpandedFst
.DrawingConfig
parameterssize
,ranksep
andnodesep
are now optional.- Fix SymbolTable conservation for
Reverse
andShortestPath
. RmEpsilon
now mutates its input.dfs_visit
now accepts anArcFilter
to be able to skip some arcs.AutoQueue
andTopOrderQueue
now take anArcFilter
in input.- Remove
Fst
trait bound onClone
andPartialEq
. However this is mandatory to be anExpandedFst
. rmepsilon
no longer requires theSemiring
to be aStarSemiring
.- Revamped RmEpsilon and ShortestDistance implementations in order to be closer to OpenFst's one.
0.4.0 - 2019-11-12
- Add
dfs
to the public interface in order to perform Depth First Search. - Add
find_strongly_connected_components
which is the implementation of the Tarjan's algoritm to find the strongly connect components in a directed graph. - Add the
FstProperties
bitflags struct and a function to commpute the property flags for anFst
. - Implement
topsort
andstatesort
. - Add
BinaryDeserializer
trait. Should be used to parse an Fst in binary format. - Implement
BinaryDeserializer
for VectorFst i.e VectorFst binary deserialization is now supported. - Add
BinarySerializer
trait. Should bbe user to serialize an Fst in binary format compatible with OpenFST. - Implement
BinarySerializer
for VectorFst i.e VectorFst binary serialization is now supported. - Implement
Minimize
algorithm. - Implement every queue types supported by OpenFST following the
Queue
trait :TrivialQueue
FifoQueue
LifoQueue
ShortestFirstQueue
TopOrderQueue
StateOrderQueue
SccQueue
AutoQueue
OtherQueue
- Implement
ShortestDistance
algorithm. - Implememt
ShortestPaths
algorithm. - Add associated type
ReverseWeight
in theSemiring
trait denoting the type of the weight reversed. - Added the crate
rustfst-cli
as a CLI for the lib. It supports the subcommands:minimize
for the minimization.connect
for the connect algorithm.arcsort
for the arcsort algorithm.invert
for the invert algorithm.project
for the project algorithm.topsort
for the topsort algorithm.map
for the Map algorithm with several mappers.reverse
for the Reverse algorithm.shortestpath
for ShortestPath algorithm.rmfinalepsilon
for RmFinaleEpsilon algorithm.push
for Weights/Labels pushing algorithm.
- Added a prelude to
rustfst
to reduce the number of imports necessary when using the lib. - Added a bench keyword the the rustfst-cli to be able to benchmark the running time of the different algorithms across multiple runs.
- Add a python package
rustfst-python-bench
to perform bench at the CLI level and at the functions level. - Added lots of unchecked (thus unsafe) functions to
Fst
andMutableFst
traits. - Add shortespath to OpenFST benchmark.
- Implemented
push
function which supports weights and / or labels pushing. - Added
take_value
method to the Semiring trait to extract a value from a Weight and take the ownership. - Added
fst_convert
to the public API to convert one Fst object from one type to another type. - Added
divide_assign
toWeaklyDivisibleSemiring
semiring to perform in-place division. - Added support for
ConstFst
. Also added a converter fromVectorFst
toConstFst
through theFrom
trait. - Added
final_weight_unnchecked_mut
toMutableFst
trait. - Added Code Coverage tests.
- Added support for binary format of
ConstFst
.
- Before test cases were generated with pynini (python wrapper around openfst). Now they are directly generated with OpenFST (c++). Allows to test operations that are not wrapped.
- Test cases are now generated directly in the CI by buiding and running openfst which allows to avoid pushing data on the repo.
- Fix issue in FactorWeight algorithm when
factor_arc_weights
was toggle on. reverse
function has now the same API as OpenFST returning an Fst ofReverseWeight
s.reverse
methods for every Semiring now returnsReverseWeight
.- Fix
reverse
ofGallicWeight
. - Stopped using
arc_map
in invert's and project's implementation to run faster. - Use
BufWriter
in theBinarySerializer
of theVectorFst
which improves a lot the serialization speed. - Optimize
arcsort
function. Can no longer fail. - Optimize
arcsum
function. Can no longer fail. Don't need to use an ArcMapper anymore. - Optimize
invert
with unchecked functions. - Optimize
project
with unchecked functions. - Optimize
reverse
. - Change implementation of
connect
algorithm which is now on par with OpenFST's one. Also works now for big fsts, no longer crashes. - Move panic from
unwind
toabort
. - Change implementation of
TopSort
algorithm andTopSortQueue
. Now usesTopSortVisitor
. - Use
SccVisitor
inAutoQueue
implementation. - Use
SccVisitor
inrm_final_epsilon
implementation. - Use
SccVisitor
incompute_fst_properties
implementation. value
methods of Semiring trait now returns a reference to the underlying weight.final_weight
method ofFst
trait now returns a reference to the final weight instead of a copy.final_weight
method ofFst
trait now returns aFallible
. Fail only when the state doesn't exist.final_weight_mut
method ofFst
trait now returns aFallible
. Fail only when the state doesn't exist.FinalStateIterator
now returns reference to final weights instead of copy.- Migrated to nom
5.0
.
- Crate
rustfst-tests-openfst
has been removed and moved to therustfst
as unit tests. - Remove
state_map
and allStateMappers
. Now use directly the functionsarc_sum
andarc_unique
.
0.3.0 - 2019-04-03
- Add
arc_map
function to perform modifications that don't modify the number of arcs (andArcMapper
to specify how to modify the arcs). - Implemented the following arc mappers to be used with
arc_map
:IdentityMapper
: Mapper that returns its input.InputEpsilonMapper
: Mapper that converts all input symbols to epsilon.InvertWeightMapper
: Mapper to inverse all non-Zero() weights.OutputEpsilonMapper
: Mapper that converts all output symbols to epsilon.PlusMapper
: Mapper to add a constant to all weights.QuantizeMapper
: Mapper to quantize all weights.RmWeightMapper
: Mapper to map all non-Zero() weights to One().TimesMapper
: Mapper to (right) multiply a constant to all weights.
- Add
final_weight_mut
to theMutableFst
trait to retrieve a mutable reference on the final weight and implemented forVectorFst
. arc_map
method has been added to the MutableFst trait as a provided method.- Add
num-traits
andordered-float
as dependency because hashing float is needed (yeah this is bad). - Add struct
FinalArc
to correctly handle final weight when performing arc mapping. - Add enum
MapFinalAction
to handle the creation of super final states when performing arc mapping. - Implement
encode
anddecode
functions to allow the representation of a weighted transducer as a weighted automaton, an unweighted transducer or an unweighted automaton. - Implement
rm_final_epsilon
which removes final states that have epsilon-only input arcs. - Add
delete_final_weight
anddelete_arcs
to the MutableFst trait and implement them forVectorFst
. - Add
ArcFilter
trait and implement it forAnyArcFilter
,EpsilonArcFilter
,InputEpsilonArcFilter
andOutputEpsilonArcFilter
. - Add
state_map
function to perform state modifications andStateMapper
to specify the modifications. - Implemented the following state mappers :
ArcSumMapper
: Mapper that Plus-sum the arcs with same nextstate, ilabel and olabel.ArcUniqueMapper
: Remove duplicate arcs.IdentityStateMapper
: Return its input.
- Add
pop_arcs
,reserve_arcs
andreserve_state
to theMutableFst
API. state_map
method has been added to the MutableFst trait as a provided method.- Implement
weight_convert
andWeightConverter
to changed the Semiring of an FST. - Implement WeightConverter trait for
IdentityArcMapper
,InputEpsilonMapper
,InvertWeightMapper
,OutputEpsilonMapper
,PlusMapper
,QuantizeMapper
,RmWeightMapper
,TimesMapper
, - Add
arcsort
to sort the outgoing arcs of an FST. - Add
ilabel_compare
,olabel_compare
andarc_compare
to compare two arcs. Can be used witharcsort
. - Add
GallicWeight
andStringWeight
. - Add
ProductWeight
: Weight W1 x W2 - Add
PowerWeight
: Weoght W ^ N - Add
UnionWeight
- Add
state_map
andStateMapper
. ImplementStateMapper
forArcSumMapper
andAddUniqueMapper
. - Implement
WeightConverter
forFromGallicMapper
andToGallicMapper
. - Add
is_acceptor
to the FST trait to detect whether an FST is an acceptor. - Implement
determinize
for both acceptors and transducers.
- In the
Semiring
trait,ONE
andZERO
associated constants have been removed in favor ofone
andzero
functions. - In the Semiring,
plus
andtimes
methods now accept aAsrRef<Self>
parameter. - Added
inverse_assign
,quantize_assign
,plus_assign
andtimes_assign
to the Semiring trait to perform in place operations. - Changed
ArcMapper
trait to useFinalArc
andMapFinalAction
. - Implement
invert
andproject
usingarc_map
. - Change internal representation of float weights to use the
ordered-float
crate and deriveHash
andEq
for each Semiring. ArcSumMapper
is now called insiderm_epsilon
function to conform with OpenFST.plus
andtimes
in Semiring now returns Fallible.ArcMapper
returns Fallible.
- Removed
Add
,AddAssign
,Mul
,MulAssign
andCopy
trait bound forSemiring
. - Removed custom
Result
type and replace it withFallible
from failure. Underneath, it is the same type.
0.2.0 - 2019-01-07
write_text
function to serialize anExpandedFst
into text format (compatible with OpenFST).draw
to generate a file representing anExpandedFst
in dot format that can be displayed with GraphViz.- Implement
num_input_epsilons
,num_output_expilons
andrelabel_pairs
. closure_plus
andclosure_star
are now also available as provided methods on aMutabeFst
.- Add
is_one
andis_zero
toSemiring
API. - Add
is_start
toFst
API. - Add
text
method to write the text representation of an fst into a string. - Add
read_text
andfrom_text_string
methods to parse a text representation of an FST. - Implement weight pushing algorithms to either start state or final states (function
push_weights
). - Implement
reverse
operation of an FST. - Implement
reweight
operation to modify the weights of an FST according to some potentials. - Implement
isomorphic
operation to compare two FSTs without depending on the ordering of the states or the arcs. - Implement a
SymbolTable
data structure to handle the mapping symbol (string) / label (int) in a FST. - Add
symt!
macro to quickly create aSymbolTable
from a list of strings. - Add
fst!
macro to quickly create an acceptor or a transducer from a list of labels. - Migrate to edition 2018 of Rust.
- Add integration tests to compare the output of this crate directly with OpenFST (by using the pynini python wrapper).
- Add weight quantization for f32 Semiring and use it in the PartialEq trait.
- Add
fst_path!
macro to easily create a FstPath object.
new
method now present in theSemiring
trait.- In all the APIs,
StateId
are now passed by value instead of reference as it is more optimized. acceptor
,transducer
,inverse
,project
,closure_plus
,closure_star
functions can't fail anymore (no Result in API).- Fix multiple issues when parsing an FST in text format.
- The
num_arcs
function in theFst
trait now computes the number of arcs leaving a specific state instead of the number of arcs in the graph. acceptor
andtransducer
methods now take slices and weight instead of only iterator of labels.- Rename
Path
object toFstPath
to avoid conflicts with the one from the standard library.
determinize
no longer public as the implementation is not satisfactory.- In the
Semiring
trait,one
andzero
functions have been removed in favor ofONE
andZERO
which are defined as associated constants. - Removed
project_input
andproject_output
functions in favor ofproject
with a type parameters.
0.1.7 - 2018-10-23
- First released version of rustfst