18 "Character separator between printed composite weights; " 19 "must be a single character");
22 "Characters enclosing the first weight of a printed composite " 23 "weight (e.g., pair weight, tuple weight and derived classes) to " 24 "ensure proper I/O of nested composite weights; " 25 "must have size 0 (none) or 2 (open and close parenthesis)");
32 std::pair<char, char> parentheses)
33 : separator_(separator),
34 open_paren_(parentheses.first),
35 close_paren_(parentheses.second),
38 FSTERROR() <<
"Invalid configuration of weight parentheses: " 47 FST_FLAGS_fst_weight_separator.empty()
49 : FST_FLAGS_fst_weight_separator.front(),
50 {FST_FLAGS_fst_weight_parentheses.empty()
52 : FST_FLAGS_fst_weight_parentheses[0],
53 FST_FLAGS_fst_weight_parentheses.size() < 2
55 : FST_FLAGS_fst_weight_parentheses[1]}) {
56 if (FST_FLAGS_fst_weight_separator.size() != 1) {
58 <<
"FST_FLAGS_fst_weight_separator.size() is not equal to 1";
61 if (!FST_FLAGS_fst_weight_parentheses.empty() &&
62 FST_FLAGS_fst_weight_parentheses.size() != 2) {
64 <<
"FST_FLAGS_fst_weight_parentheses.size() is not equal to 2";
73 if (
error()) ostrm.clear(std::ios::badbit);
80 if (
error()) ostrm_.clear(std::ios::badbit);
97 if (
error()) istrm_.clear(std::ios::badbit);
104 if (
error()) istrm_.clear(std::ios::badbit);
110 }
while (std::isspace(c_));
113 FSTERROR() <<
"CompositeWeightReader: Open paren missing: " 114 <<
"fst_weight_parentheses flag set correcty?";
115 istrm_.clear(std::ios::badbit);
124 if (c_ != EOF && !std::isspace(c_)) {
125 FSTERROR() <<
"CompositeWeightReader: excess character: '" 126 <<
static_cast<char>(c_)
127 <<
"': fst_weight_parentheses flag set correcty?";
128 istrm_.clear(std::ios::badbit);
std::pair< char, char > parentheses() const
DEFINE_string(fst_weight_separator,",","Character separator between printed composite weights; ""must be a single character")
CompositeWeightReader(std::istream &istrm)
CompositeWeightWriter(std::ostream &ostrm)