ModErn Text Analysis
META Enumerates Textual Applications
featurizer_factory.h
Go to the documentation of this file.
1 
10 #ifndef META_ANALYZERS_TREE_FEATURIZER_FACTORY_H_
11 #define META_ANALYZERS_TREE_FEATURIZER_FACTORY_H_
12 
14 #include "util/factory.h"
15 #include "util/shim.h"
16 
17 namespace cpptoml
18 {
19 class table;
20 }
21 
22 namespace meta
23 {
24 namespace analyzers
25 {
26 
33  : public util::factory<featurizer_factory, tree_featurizer>
34 {
36  friend base_factory;
37 
38  private:
43 
48  template <class Analyzer>
49  void register_featurizer();
50 
52  std::unordered_map<std::string, factory_method> methods_;
53 };
54 
58 template <class Featurizer>
59 std::unique_ptr<tree_featurizer> make_featurizer()
60 {
61  return make_unique<Featurizer>();
62 }
63 
68 template <class Featurizer>
70 {
71  featurizer_factory::get().add(Featurizer::id, make_featurizer<Featurizer>);
72 }
73 }
74 }
75 #endif
featurizer_factory()
Constructor.
Definition: featurizer_factory.cpp:20
void add(const std::string &identifier, Function &&fn)
Associates the given identifier with the given factory method.
Definition: factory.h:61
friend base_factory
friend the base class
Definition: featurizer_factory.h:36
Generic factory that can be subclassed to create factories for specific types.
Definition: factory.h:27
static featurizer_factory & get()
Obtains the singleton.
Definition: factory.h:48
std::unordered_map< std::string, factory_method > methods_
maps id strings to the factory method used to create that class
Definition: featurizer_factory.h:52
Factory that is responsible for creating tree featurizers from configuration files.
Definition: featurizer_factory.h:32
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
std::unique_ptr< tree_featurizer > make_featurizer()
Factory method for creating a featurizer.
Definition: featurizer_factory.h:59
void register_featurizer()
Registration method for analyzers.
Definition: featurizer_factory.h:69
void register_featurizer()
Adds (registers) a featurizer with this factory so it is able to be created.
Definition: featurizer_factory.cpp:15
Definition: analyzer.h:19