Natural Language Processing  0.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
grammar.h
1 #ifndef GRAMMAR_H
2 #define GRAMMAR_H
3 #include <iostream>
4 #include <map>
5 #include <vector>
6 #include "../../../CONFIG/config.h"
7 
8 using namespace NLP;
9 //In the structure, each phrase is in a sense unique, in that if there exist
10 //multiple 'nominals' in the structure, no matter what leads to the nominal, each
11 //nominal can go to every possible path any other nominal can go
12 //So in this sense, the phrases are unique, thus we can just identify them
13 //with their names.
14 //If we wish to see if one phrase can lead to another, it does not matter if there
15 //are multiple versions of this phrase in the structure, if one of them can lead to the
16 //other phrase, they all can.
17 
18 
24 class Grammar{
25 private:
29  mmap _grammar;
30  void createInitialRule();
31 public:
32  Grammar();
33  void addRule(const GrammarPhrase& define, const GPlist& rule);
34  void removeRule(const GrammarPhrase& define, const GPlist& rule);
35  friend std::ostream& operator <<(std::ostream& out, const Grammar& G);
36  std::vector<GPlist> getDefinition(const GrammarPhrase& define);
37  GrammarPhrase getDefiner(const GPlist& rule);
38 
39 };
40 #endif // GRAMMAR_H
std::multimap< GrammarPhrase, GPlist > mmap
mmap typedef for multimpa<GrammarPhrase, vector<GrammarPhrase> >
Definition: config.h:269
The Grammar class A generic Grammar class that contains a multimap. It maps a Grammar Phrase to a vec...
Definition: grammar.h:24
std::vector< GrammarPhrase > GPlist
GPlist typedef for vector<GrammarPhrase>
Definition: config.h:265
GrammarPhrase
The GrammarPhrase enum Denotes the Grammar Phrase.
Definition: config.h:99