15 #ifndef TASK_READFST_HPP 16 #define TASK_READFST_HPP 32 template <
class Data,
class Arc = fst::StdArc >
40 std::string previousfile_;
44 boost::scoped_ptr< fst::VectorFst<Arc> > fst_;
49 const std::string& fstkey
52 fstfile_ ( rg.get<std::string> ( fstkey ) ) {
57 const std::string& fstkey
69 bool run ( Data& d ) {
71 if ( fstfile_ ( d.sidx ) !=
"" && fstfile_ ( d.sidx ) != previousfile_ ) {
72 LINFO (
"Loading ... " << fstfile_ ( d.sidx ) <<
" with key=" << fstkey_ );
73 fst_.reset ( fst::VectorFstRead<Arc> ( fstfile_ ( d.sidx ) ) );
74 d.fsts[fstkey_] = fst_.get();
75 previousfile_ = fstfile_ ( d.sidx );
98 const std::string& fstkey ,
101 if ( rg.
exists ( fstkey ) )
108 LERROR (
"Unknown arc type:" << arctype);
class that expands a wildcard into its actual value. This is useful e.g. for filenames ranging severa...
Templated (hybrid) Interface for Task classes.
std::string const kHifstSemiringLexStdArc
std::string const kHifstSemiringStdArc
bool exists(const std::string &key) const
Determines whether a program option (key) has been defined by the user.