30 "Character separator between printed composite weights; " 31 "must be a single character");
34 "Characters enclosing the first weight of a printed composite " 35 "weight (e.g., pair weight, tuple weight and derived classes) to " 36 "ensure proper I/O of nested composite weights; " 37 "must have size 0 (none) or 2 (open and close parenthesis)");
44 std::pair<char, char> parentheses)
45 : separator_(separator),
46 open_paren_(parentheses.first),
47 close_paren_(parentheses.second),
50 FSTERROR() <<
"Invalid configuration of weight parentheses: " 59 FST_FLAGS_fst_weight_separator.empty()
61 : FST_FLAGS_fst_weight_separator.front(),
62 {FST_FLAGS_fst_weight_parentheses.empty()
64 : FST_FLAGS_fst_weight_parentheses[0],
65 FST_FLAGS_fst_weight_parentheses.size() < 2
67 : FST_FLAGS_fst_weight_parentheses[1]}) {
68 if (FST_FLAGS_fst_weight_separator.size() != 1) {
70 <<
"FST_FLAGS_fst_weight_separator.size() is not equal to 1";
73 if (!FST_FLAGS_fst_weight_parentheses.empty() &&
74 FST_FLAGS_fst_weight_parentheses.size() != 2) {
76 <<
"FST_FLAGS_fst_weight_parentheses.size() is not equal to 2";
85 if (
error()) ostrm.clear(std::ios::badbit);
92 if (
error()) ostrm_.clear(std::ios::badbit);
109 if (
error()) istrm_.clear(std::ios::badbit);
116 if (
error()) istrm_.clear(std::ios::badbit);
122 }
while (std::isspace(c_));
125 FSTERROR() <<
"CompositeWeightReader: Open paren missing: " 126 <<
"fst_weight_parentheses flag set correcty?";
127 istrm_.clear(std::ios::badbit);
136 if (c_ != EOF && !std::isspace(c_)) {
137 FSTERROR() <<
"CompositeWeightReader: excess character: '" 138 <<
static_cast<char>(c_)
139 <<
"': fst_weight_parentheses flag set correcty?";
140 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)