37 #include <string_view> 39 #define REGISTER_FST_OPERATION_4ARCS(Op, ArgPack) \ 40 REGISTER_FST_OPERATION_3ARCS(Op, ArgPack); \ 41 REGISTER_FST_OPERATION(Op, ErrorArc, ArgPack) 49 const std::string &symbols_source,
50 const std::string &unknown_symbol,
bool keep_symbols,
51 bool initial_symbols,
const std::string &key_prefix,
52 const std::string &key_suffix) {
65 Apply<Operation<FarCompileStringsArgs>>(
"CompileStrings", writer.
ArcType(),
72 std::string_view fst_type) {
74 Apply<Operation<FarConvertArgs>>(
"Convert", reader.
ArcType(), &args);
80 const int32_t generate_keys,
const std::string &key_prefix,
81 const std::string &key_suffix) {
82 FarCreateArgs args{sources, writer, generate_keys, key_prefix, key_suffix};
83 Apply<Operation<FarCreateArgs>>(
"Create", writer.
ArcType(), &args);
95 Apply<Operation<FarDecodeArgs>>(
"Decode", reader.
ArcType(), &args);
107 Apply<Operation<FarEncodeArgs>>(
"Encode", reader.
ArcType(), &args);
113 std::string_view begin_key, std::string_view end_key) {
117 Apply<Operation<FarEqualArgs>>(
"Equal", reader1.
ArcType(), &args_with_retval);
118 return args_with_retval.
retval;
124 const std::string &keys,
const std::string &key_separator,
125 const std::string &range_delimiter,
126 const std::string &source_prefix,
127 const std::string &source_suffix) {
129 key_separator, range_delimiter, source_prefix,
131 Apply<Operation<FarExtractArgs>>(
"Extract", reader.
ArcType(), &args);
136 void GetInfo(
const std::vector<std::string> &sources,
137 const std::string &arc_type,
const std::string &begin_key,
138 const std::string &end_key,
bool list_fsts,
FarInfoData *data) {
139 FarGetInfoArgs args{sources, begin_key, end_key, list_fsts, data};
140 Apply<Operation<FarGetInfoArgs>>(
"GetInfo", arc_type, &args);
145 void Info(
const std::vector<std::string> &sources,
const std::string &arc_type,
146 const std::string &begin_key,
const std::string &end_key,
148 FarInfoArgs args{sources, begin_key, end_key, list_fsts};
149 Apply<Operation<FarInfoArgs>>(
"Info", arc_type, &args);
155 std::string_view begin_key, std::string_view end_key) {
159 Apply<Operation<FarIsomorphicArgs>>(
"Isomorphic", reader1.
ArcType(),
161 return args_with_retval.
retval;
167 const TokenType token_type,
const std::string &begin_key,
168 const std::string &end_key,
bool print_key,
bool print_weight,
169 const std::string &symbols_source,
bool initial_symbols,
170 const int32_t generate_sources,
171 const std::string &source_prefix,
172 const std::string &source_suffix) {
174 begin_key, end_key, print_key,
175 print_weight, symbols_source, initial_symbols,
176 generate_sources, source_prefix, source_suffix};
177 Apply<Operation<FarPrintStringsArgs>>(
"PrintStrings", reader.
ArcType(),
void PrintStrings(FarReaderClass &reader, const FarEntryType entry_type, const TokenType token_type, const std::string &begin_key, const std::string &end_key, bool print_key, bool print_weight, const std::string &symbols_source, bool initial_symbols, const int32_t generate_sources, const std::string &source_prefix, const std::string &source_suffix)
void GetInfo(const std::vector< std::string > &sources, const std::string &arc_type, const std::string &begin_key, const std::string &end_key, bool list_fsts, FarInfoData *data)
std::tuple< const std::vector< std::string > &, const std::string &, const std::string &, const bool > FarInfoArgs
bool Equal(FarReaderClass &reader1, FarReaderClass &reader2, float delta, std::string_view begin_key, std::string_view end_key)
std::tuple< FarReaderClass &, FarReaderClass &, float, std::string_view, std::string_view > FarIsomorphicInnerArgs
bool Isomorphic(FarReaderClass &reader1, FarReaderClass &reader2, float delta, std::string_view begin_key, std::string_view end_key)
std::tuple< FarReaderClass &, FarWriterClass &, EncodeMapperClass * > FarEncodeArgs
std::tuple< FarReaderClass &, FarWriterClass &, std::string_view > FarConvertArgs
std::tuple< const std::vector< std::string > &, const std::string &, const std::string &, const bool, FarInfoData * > FarGetInfoArgs
std::tuple< FarReaderClass &, int32_t, const std::string &, const std::string &, const std::string &, const std::string &, const std::string & > FarExtractArgs
void Decode(FarReaderClass &reader, FarWriterClass &writer, const EncodeMapperClass &encoder)
bool ArcTypesMatch(const M &m, const N &n, const std::string &op_name)
void Info(const std::vector< std::string > &sources, const std::string &arc_type, const std::string &begin_key, const std::string &end_key, bool list_fsts)
std::tuple< FarReaderClass &, FarWriterClass &, const EncodeMapperClass & > FarDecodeArgs
const std::string & ArcType() const
void Encode(FarReaderClass &reader, FarWriterClass &writer, EncodeMapperClass *encoder)
REGISTER_FST_OPERATION_4ARCS(CompileStrings, FarCompileStringsArgs)
std::tuple< FarReaderClass &, FarReaderClass &, float, std::string_view, std::string_view > FarEqualInnerArgs
void Create(const std::vector< std::string > &sources, FarWriterClass &writer, const int32_t generate_keys, const std::string &key_prefix, const std::string &key_suffix)
const std::string & ArcType() const
void Extract(FarReaderClass &reader, int32_t generate_sources, const std::string &keys, const std::string &key_separator, const std::string &range_delimiter, const std::string &source_prefix, const std::string &source_suffix)
void CompileStrings(const std::vector< std::string > &sources, FarWriterClass &writer, std::string_view fst_type, int32_t generate_keys, FarEntryType fet, TokenType tt, const std::string &symbols_source, const std::string &unknown_symbol, bool keep_symbols, bool initial_symbols, const std::string &key_prefix, const std::string &key_suffix)
void Convert(FarReaderClass &reader, FarWriterClass &writer, std::string_view fst_type)