The morphological analyzer is a meta-module which does not perform any processing of its own.
It is just a convenience module to simplify the instantiation and call to the submodules described in the next sections (from 3.4 to 3.11).
At instantiation time, it receives a maco_options object, containing information about which submodules have to be created and which files have to be used to create them.
A calling application may bypass this module and just call directly the submodules.
The Morphological Analyzer API is:
class maco { public: /// Constructor. Receives a set of options. maco(const maco_options &); /// analyze and enrich given sentences. void analyze(std::list<sentence> &); };
The maco_options class has the following API:
class maco_options { public: /// Language analyzed std::string Lang; /// Submodules to activate bool AffixAnalysis, MultiwordsDetection, NumbersDetection, PunctuationDetection, DatesDetection, QuantitiesDetection, DictionarySearch, ProbabilityAssignment; /// kind of NER wanted (NER_BASIC, NER_BIO, NER_NONE) int NERecognition; /// Names of data files to provide to each submodule. std::string LocutionsFile, QuantitiesFile, AffixFile, ProbabilityFile, DictionaryFile, NPdataFile, PunctuationFile; /// Extra parameters for Number Detection module std::string Decimal, Thousand; /// Extra parameters for Probability Assignment module double ProbabilityThreshold; /// constructor maco_options(const std::string &); /// Option setting methods provided to ease perl interface generation. /// Since option data members are public and can be accessed directly /// from C++, the following methods are not necessary, but may become /// convenient sometimes. /// The order of the parameters is the same they are defined above. void set_active_modules(bool,bool,bool,bool,bool,bool,bool,bool,int,bool); void set_data_files(const std::string &,const std::string &, const std::string &,const std::string &, const std::string &,const std::string &, const std::string &,const std::string &); void set_nummerical_points(const std::string &,const std::string &); void set_threshold(double);
To instantiate a Morphological Analyzer object, the calling application needs to instantiate a maco_options object, initialize its fields with the desired values, and use it to call the constructor of the maco class.
The created object will create the required submodules, and when asked to analyze some sentences, it will just pass it down to each the submodule, and return the final result.