6 #ifndef TURI_FE_ngram_counter_H_ 7 #define TURI_FE_ngram_counter_H_ 8 #include <model_server/lib/toolkit_class_macros.hpp> 9 #include <toolkits/feature_engineering/transformer_base.hpp> 10 #include <toolkits/feature_engineering/transform_utils.hpp> 11 #include <core/export.hpp> 15 namespace feature_engineering {
17 class EXPORT ngram_counter:
public transformer_base {
19 static constexpr
size_t NGRAM_COUNTER_VERSION = 0;
23 bool ignore_punct =
true;
24 bool ignore_space =
true;
26 std::map<std::string, flex_type_enum> feature_types;
27 std::vector<std::string> feature_columns;
28 flexible_type unprocessed_features;
29 flexible_type delimiters;
33 transform_utils::string_filter_list string_filters;
35 void set_string_filters();
43 virtual inline ~ngram_counter() {}
52 void init_options(
const std::map<std::string, flexible_type>&_options)
override;
58 size_t get_version()
const override;
74 void init_transformer(
const std::map<std::string,
75 flexible_type>& _options)
override;
82 void fit(gl_sframe data)
override;
94 gl_sframe
transform(gl_sframe data)
override;
103 gl_sframe fit_transform(gl_sframe data) {
120 ngram_counter::get_default_options);
122 ngram_counter::get_value_from_state,
#define BEGIN_CLASS_MEMBER_REGISTRATION(python_facing_classname)
#define REGISTER_CLASS_MEMBER_FUNCTION(function,...)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
#define END_CLASS_MEMBER_REGISTRATION
#define REGISTER_NAMED_CLASS_MEMBER_FUNCTION(name, function,...)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
void transform(S &&input, T &&output, TransformFn transformfn, std::set< size_t > constraint_segments=std::set< size_t >())